Skip to content

Commit

Permalink
Use an environment variable for configuring Ollama integration tests (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
eiriktsarpalis authored Feb 6, 2025
1 parent 150bfde commit 19fd307
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
9 changes: 9 additions & 0 deletions src/Libraries/Microsoft.Extensions.AI/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,12 @@ Optionally also run the following. The values shown here are the defaults if you
dotnet user-secrets set AzureAIInference:ChatModel gpt-4o-mini
dotnet user-secrets set AzureAIInference:EmbeddingModel text-embedding-3-small
```

### Configuring Ollama tests

Run commands like the following. The settings will be saved in your user profile.

```
cd test/Libraries/Microsoft.Extensions.AI.Integration.Tests
dotnet user-secrets set Ollama:Endpoint http://localhost:11434/
```
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ internal static class IntegrationTestHelpers
/// <summary>Gets a <see cref="Uri"/> to use for testing, or null if the associated tests should be disabled.</summary>
public static Uri? GetOllamaUri()
{
// return new Uri("http://localhost:11434");
return null;
return TestRunnerConfiguration.Instance["Ollama:Endpoint"] is string endpoint
? new Uri(endpoint)
: null;
}
}

0 comments on commit 19fd307

Please sign in to comment.