Skip to content

Commit 1eafdc9

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

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

@@ -421,7 +420,7 @@ static std::string rubra_format_function_call_str(const std::vector<json> & func
421420
for (const auto& def : function_definitions) {
422421
final_str += def + "\n";
423422
}
424-
final_str += "Use the following format if using a tool:\n[toolname1(arg1=value1, arg2=value2, ...), toolname2(arg1=value1, arg2=value2, ...)]";
423+
final_str += "Use the following format if using tools:\n<<functions>>[toolname1(arg1=value1, arg2=value2, ...), toolname2(arg1=value1, arg2=value2, ...)]";
425424
return final_str;
426425
}
427426

@@ -507,7 +506,7 @@ static json oaicompat_completion_params_parse(
507506
// temp_vec.push_back(function_call);
508507
// }
509508
std::vector<json> temp_vec;
510-
std::unordered_map<std::string, std::string> func_observation_map;
509+
nlohmann::ordered_map<std::string, std::string> func_observation_map;
511510
for (size_t i = 0; i < body["messages"].size(); ++i) {
512511

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

0 commit comments

Comments
 (0)