Skip to content

Commit

Permalink
Cleaner tools test
Browse files Browse the repository at this point in the history
  • Loading branch information
kgrofelnik committed Mar 28, 2024
1 parent 01006ef commit 2aaa6d2
Showing 1 changed file with 41 additions and 1 deletion.
42 changes: 41 additions & 1 deletion contracts/test/OpenAiChatGpt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,47 @@ describe("OpenAiChatGpt", function () {
await chatGpt.startChat("Hello");
// promptId: 0, callbackId: 0
const openAiConf = await oracle.openAiConfigurations(0)
expect(openAiConf.toString()).to.equal("gpt-4-turbo-preview,21,,1000,21,{\"type\":\"text\"},0,,10,101,[{\"type\":\"function\",\"function\":{\"name\":\"web_search\",\"description\":\"Search the internet\",\"parameters\":{\"type\":\"object\",\"properties\":{\"query\":{\"type\":\"string\",\"description\":\"Search query\"}},\"required\":[\"query\"]}}},{\"type\":\"function\",\"function\":{\"name\":\"code_interpreter\",\"description\":\"Evaluates python code in a sandbox environment. The environment resets on every execution. You must send the whole script every time and print your outputs. Script should be pure python code that can be evaluated. It should be in python format NOT markdown. The code should NOT be wrapped in backticks. All python packages including requests, matplotlib, scipy, numpy, pandas, etc are available. Output can only be read from stdout, and stdin. Do not use things like plot.show() as it will not work. print() any output and results so you can capture the output.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"code\":{\"type\":\"string\",\"description\":\"The pure python script to be evaluated. The contents will be in main.py. It should not be in markdown format.\"}},\"required\":[\"code\"]}}}],auto,")
const tools = [
{
"type": "function",
"function": {
"name": "web_search",
"description": "Search the internet",
"parameters": {
"type": "object",
"properties": {
"query": {
"type": "string",
"description": "Search query"
}
},
"required": [
"query"
]
}
}
},
{
"type": "function",
"function": {
"name": "code_interpreter",
"description": "Evaluates python code in a sandbox environment. The environment resets on every execution. You must send the whole script every time and print your outputs. Script should be pure python code that can be evaluated. It should be in python format NOT markdown. The code should NOT be wrapped in backticks. All python packages including requests, matplotlib, scipy, numpy, pandas, etc are available. Output can only be read from stdout, and stdin. Do not use things like plot.show() as it will not work. print() any output and results so you can capture the output.",
"parameters": {
"type": "object",
"properties": {
"code": {
"type": "string",
"description": "The pure python script to be evaluated. The contents will be in main.py. It should not be in markdown format."
}
},
"required": [
"code"
]
}
}
}
];
expect(openAiConf.toString()).to.equal(`gpt-4-turbo-preview,21,,1000,21,{\"type\":\"text\"},0,,10,101,${JSON.stringify(tools)},auto,`);
});
it("Oracle can add response", async () => {
const {chatGpt, oracle, allSigners} = await loadFixture(deploy);
Expand Down

0 comments on commit 2aaa6d2

Please sign in to comment.