Tools optional.
This commit is contained in:
parent
1ff0e9ed97
commit
f5994bc03b
4
chat.h
4
chat.h
@ -51,7 +51,9 @@ char *chat_json(const char *role, const char *message) {
|
|||||||
|
|
||||||
if (role != NULL && message != NULL) {
|
if (role != NULL && message != NULL) {
|
||||||
message_add(role, message);
|
message_add(role, message);
|
||||||
json_object_object_add(root_object, "tools", tools_descriptions());
|
if(use_tools()){
|
||||||
|
json_object_object_add(root_object, "tools", tools_descriptions());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
json_object_object_add(root_object, "messages", message_list());
|
json_object_object_add(root_object, "messages", message_list());
|
||||||
|
20
r.h
20
r.h
@ -32,6 +32,26 @@ char *_model = NULL;
|
|||||||
#define DB_FILE "~/.r.db"
|
#define DB_FILE "~/.r.db"
|
||||||
#define PROMPT_TEMPERATURE 0.1
|
#define PROMPT_TEMPERATURE 0.1
|
||||||
|
|
||||||
|
|
||||||
|
bool use_tools(){
|
||||||
|
if(getenv("R_USE_TOOLS") != NULL){
|
||||||
|
const char *value = getenv("R_USE_TOOLS");
|
||||||
|
if (!strcmp(value, "true")) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (!strcmp(value, "false")) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!strcmp(value, "1")) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (!strcmp(value, "0")) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
char * get_env_system_message(){
|
char * get_env_system_message(){
|
||||||
if (getenv("R_SYSTEM_MESSAGE") != NULL) {
|
if (getenv("R_SYSTEM_MESSAGE") != NULL) {
|
||||||
return strdup(getenv("R_SYSTEM_MESSAGE"));
|
return strdup(getenv("R_SYSTEM_MESSAGE"));
|
||||||
|
Loading…
Reference in New Issue
Block a user