Skip to content

Commit 1100736

Browse files
committed
test: Updated WikiTests.
1 parent b430444 commit 1100736

File tree

1 file changed

+21
-11
lines changed

1 file changed

+21
-11
lines changed

src/Meta/test/WikiTests.cs

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -40,20 +40,30 @@ public async Task AgentWithOllama()
4040
[Test]
4141
public async Task AgentWithOllamaReact()
4242
{
43-
var provider = new OllamaProvider(
44-
options: new RequestOptions
45-
{
46-
Stop = new[] { "Observation", "[END]" }, // add injection word `Observation` and `[END]` to stop the model(just as additional safety feature)
47-
Temperature = 0
48-
});
49-
var model = new OllamaChatModel(provider, id: "mistral:latest").UseConsoleForDebug();
50-
51-
// create a google search tool
52-
var searchTool = new GoogleCustomSearchTool(key: "<your key>", cx: "<your cx>", resultsLimit: 1);
43+
// var provider = new OllamaProvider(
44+
// options: new RequestOptions
45+
// {
46+
// Stop = new[] { "Observation", "[END]" }, // add injection word `Observation` and `[END]` to stop the model(just as additional safety feature)
47+
// Temperature = 0
48+
// });
49+
//var llm = new OllamaChatModel(provider, id: "mistral:latest").UseConsoleForDebug();
50+
var apiKey =
51+
Environment.GetEnvironmentVariable("OPENAI_API_KEY") ??
52+
throw new InvalidOperationException("OpenAI API key is not set");
53+
var llm = new Gpt35TurboModel(apiKey);
54+
55+
// create a google search
56+
var searchApiKey =
57+
Environment.GetEnvironmentVariable("GOOGLE_SEARCH_API_KEY") ??
58+
throw new InvalidOperationException("GOOGLE_SEARCH_API_KEY is not set");
59+
var cx =
60+
Environment.GetEnvironmentVariable("GOOGLE_SEARCH_CX") ??
61+
throw new InvalidOperationException("GOOGLE_SEARCH_CX is not set");
62+
var searchTool = new GoogleCustomSearchTool(key: searchApiKey, cx: cx, resultsLimit: 1);
5363

5464
var chain =
5565
Set("What is tryAGI/LangChain?")
56-
| ReActAgentExecutor(model) // does the magic
66+
| ReActAgentExecutor(llm) // does the magic
5767
.UseTool(searchTool); // add the google search tool
5868

5969
await chain.RunAsync();

0 commit comments

Comments
 (0)