Skip to content

Commit 270684a

Browse files
committed
Using ordered_map instead to make sure the function call observations are in the correct order.
1 parent 1c563bf commit 270684a

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

examples/server/python-parser.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ static std::vector<json> parsePythonFunctionCalls(std::string source_string) {
103103
std::vector<json> calls;
104104
std::string delimiter = "<<functions>>";
105105
std::string source_code;
106-
printf("Parsing source_string: %s\n", source_string.c_str());
106+
printf("Parsing source_string::%s\n", source_string.c_str());
107107
size_t startPos = source_string.find(delimiter);
108108
if (startPos != std::string::npos) {
109109
source_code = source_string.substr(startPos + delimiter.length());

examples/server/utils.hpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#include <vector>
1111
#include <sstream>
1212
#include <random>
13-
#include <unordered_map>
1413

1514
#define DEFAULT_OAICOMPAT_MODEL "gpt-3.5-turbo-0613"
1615

@@ -432,7 +431,7 @@ static std::string rubra_format_function_call_str(const std::vector<json> & func
432431
for (const auto& def : function_definitions) {
433432
final_str += def + "\n";
434433
}
435-
final_str += "Use the following format if using a tool:\n[toolname1(arg1=value1, arg2=value2, ...), toolname2(arg1=value1, arg2=value2, ...)]";
434+
final_str += "Use the following format if using tools:\n<<functions>>[toolname1(arg1=value1, arg2=value2, ...), toolname2(arg1=value1, arg2=value2, ...)]";
436435
return final_str;
437436
}
438437

@@ -518,7 +517,7 @@ static json oaicompat_completion_params_parse(
518517
// temp_vec.push_back(function_call);
519518
// }
520519
std::vector<json> temp_vec;
521-
std::unordered_map<std::string, std::string> func_observation_map;
520+
nlohmann::ordered_map<std::string, std::string> func_observation_map;
522521
for (size_t i = 0; i < body["messages"].size(); ++i) {
523522

524523
if (body["messages"][i]["role"] != "tool" and func_observation_map.size() > 0) {

0 commit comments

Comments
 (0)