Skip to content

Commit 19fd307

Browse files
Use an environment variable for configuring Ollama integration tests (#5851)
1 parent 150bfde commit 19fd307

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

src/Libraries/Microsoft.Extensions.AI/README.md

+9
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,12 @@ Optionally also run the following. The values shown here are the defaults if you
8383
dotnet user-secrets set AzureAIInference:ChatModel gpt-4o-mini
8484
dotnet user-secrets set AzureAIInference:EmbeddingModel text-embedding-3-small
8585
```
86+
87+
### Configuring Ollama tests
88+
89+
Run commands like the following. The settings will be saved in your user profile.
90+
91+
```
92+
cd test/Libraries/Microsoft.Extensions.AI.Integration.Tests
93+
dotnet user-secrets set Ollama:Endpoint http://localhost:11434/
94+
```

test/Libraries/Microsoft.Extensions.AI.Ollama.Tests/IntegrationTestHelpers.cs

+3-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ internal static class IntegrationTestHelpers
1313
/// <summary>Gets a <see cref="Uri"/> to use for testing, or null if the associated tests should be disabled.</summary>
1414
public static Uri? GetOllamaUri()
1515
{
16-
// return new Uri("http://localhost:11434");
17-
return null;
16+
return TestRunnerConfiguration.Instance["Ollama:Endpoint"] is string endpoint
17+
? new Uri(endpoint)
18+
: null;
1819
}
1920
}

0 commit comments

Comments
 (0)