Skip to content

Commit

Permalink
feat: Use llama3.2 as default.
Browse files Browse the repository at this point in the history
  • Loading branch information
HavenDV committed Sep 26, 2024
1 parent eaaed7d commit 744304b
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 24 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ var embedding = await ollama.Embeddings.GenerateEmbeddingAsync(
// Streaming a completion directly into the console
// keep reusing the context to keep the chat topic going
IList<long>? context = null;
var enumerable = ollama.Completions.GenerateCompletionAsync("llama3.1", "answer 5 random words");
var enumerable = ollama.Completions.GenerateCompletionAsync("llama3.2", "answer 5 random words");
await foreach (var response in enumerable)
{
Console.WriteLine($"> {response.Response}");

context = response.Context;
}

var lastResponse = await ollama.Completions.GenerateCompletionAsync("llama3.1", "answer 123", stream: false, context: context).WaitAsync();
var lastResponse = await ollama.Completions.GenerateCompletionAsync("llama3.2", "answer 123", stream: false, context: context).WaitAsync();
Console.WriteLine(lastResponse.Response);

var chat = ollama.Chat("mistral");
Expand All @@ -65,7 +65,7 @@ while (true)
```csharp
using var ollama = new OllamaApiClient();
var chat = ollama.Chat(
model: "llama3.1",
model: "llama3.2",
systemMessage: "You are a helpful weather assistant.",
autoCallTools: true);

Expand Down
6 changes: 3 additions & 3 deletions src/helpers/GenerateDocs/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@
"await using var container = await PrepareEnvironmentAsync(EnvironmentType.Container);",
"using var api = new OllamaApiClient();")
.Replace(
"await using var container = await PrepareEnvironmentAsync(EnvironmentType.Local, \"llama3.1\");",
"await using var container = await PrepareEnvironmentAsync(EnvironmentType.Local, \"llama3.2\");",
string.Empty)
.Replace(
"await using var container = await PrepareEnvironmentAsync(EnvironmentType.Container, \"llama3.1\");",
"await using var container = await PrepareEnvironmentAsync(EnvironmentType.Container, \"llama3.2\");",
@"using var api = new OllamaApiClient();
await apiClient.Models.PullModelAsync(""llama3.1"").EnsureSuccessAsync();")
await apiClient.Models.PullModelAsync(""llama3.2"").EnsureSuccessAsync();")
.Replace(
"await using var container = await PrepareEnvironmentAsync(EnvironmentType.Local, \"reader-lm:latest\");",
string.Empty)
Expand Down
6 changes: 3 additions & 3 deletions src/tests/Ollama.IntegrationTests/Tests.Chat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ public partial class Tests
public async Task Chat()
{
#if DEBUG
await using var container = await PrepareEnvironmentAsync(EnvironmentType.Local, "llama3.1");
await using var container = await PrepareEnvironmentAsync(EnvironmentType.Local, "llama3.2");
#else
await using var container = await PrepareEnvironmentAsync(EnvironmentType.Container, "llama3.1");
await using var container = await PrepareEnvironmentAsync(EnvironmentType.Container, "llama3.2");
#endif

var chat = container.ApiClient.Chat("llama3.1");
var chat = container.ApiClient.Chat("llama3.2");
var message = await chat.SendAsync("answer 5 random words");

Console.WriteLine(message.Content);
Expand Down
8 changes: 4 additions & 4 deletions src/tests/Ollama.IntegrationTests/Tests.GetCompletion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@ public partial class Tests
public async Task GetCompletion()
{
#if DEBUG
await using var container = await PrepareEnvironmentAsync(EnvironmentType.Local, "llama3.1");
await using var container = await PrepareEnvironmentAsync(EnvironmentType.Local, "llama3.2");
#else
await using var container = await PrepareEnvironmentAsync(EnvironmentType.Container, "llama3.1");
await using var container = await PrepareEnvironmentAsync(EnvironmentType.Container, "llama3.2");
#endif

IList<long>? context = null;
var enumerable = container.ApiClient.Completions.GenerateCompletionAsync("llama3.1", "answer 5 random words");
var enumerable = container.ApiClient.Completions.GenerateCompletionAsync("llama3.2", "answer 5 random words");
await foreach (var response in enumerable)
{
Console.WriteLine($"> {response.Response}");

context = response.Context;
}

var lastResponse = await container.ApiClient.Completions.GenerateCompletionAsync("llama3.1", "answer 123", stream: false, context: context).WaitAsync();
var lastResponse = await container.ApiClient.Completions.GenerateCompletionAsync("llama3.2", "answer 123", stream: false, context: context).WaitAsync();
Console.WriteLine(lastResponse.Response);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ public partial class Tests
public async Task GetCompletionWithOptions()
{
#if DEBUG
await using var container = await PrepareEnvironmentAsync(EnvironmentType.Local, "llama3.1");
await using var container = await PrepareEnvironmentAsync(EnvironmentType.Local, "llama3.2");
#else
await using var container = await PrepareEnvironmentAsync(EnvironmentType.Container, "llama3.1");
await using var container = await PrepareEnvironmentAsync(EnvironmentType.Container, "llama3.2");
#endif

var response = await container.ApiClient.Completions.GenerateCompletionAsync(new GenerateCompletionRequest
{
Model = "llama3.1",
Model = "llama3.2",
Prompt = "answer me just \"123\"",
Stream = true,
Options = new RequestOptions
Expand Down
6 changes: 3 additions & 3 deletions src/tests/Ollama.IntegrationTests/Tests.Tools.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ public partial class Tests
public async Task Tools()
{
#if DEBUG
await using var container = await PrepareEnvironmentAsync(EnvironmentType.Local, "llama3.1");
await using var container = await PrepareEnvironmentAsync(EnvironmentType.Local, "llama3.2");
#else
await using var container = await PrepareEnvironmentAsync(EnvironmentType.Container, "llama3.1");
await using var container = await PrepareEnvironmentAsync(EnvironmentType.Container, "llama3.2");
#endif

var messages = new List<Message>
{
"You are a helpful weather assistant.".AsSystemMessage(),
"What is the current temperature in Dubai, UAE in Celsius?".AsUserMessage(),
};
const string model = "llama3.1";
const string model = "llama3.2";

try
{
Expand Down
6 changes: 3 additions & 3 deletions src/tests/Ollama.IntegrationTests/Tests.ToolsInChat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ public partial class Tests
public async Task ToolsInChat()
{
#if DEBUG
await using var container = await PrepareEnvironmentAsync(EnvironmentType.Local, "llama3.1");
await using var container = await PrepareEnvironmentAsync(EnvironmentType.Local, "llama3.2");
#else
await using var container = await PrepareEnvironmentAsync(EnvironmentType.Container, "llama3.1");
await using var container = await PrepareEnvironmentAsync(EnvironmentType.Container, "llama3.2");
#endif

var chat = container.ApiClient.Chat(
model: "llama3.1",
model: "llama3.2",
systemMessage: "You are a helpful weather assistant.",
autoCallTools: true);

Expand Down
4 changes: 2 additions & 2 deletions src/tests/Ollama.IntegrationTests/Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ private static async Task<Environment> PrepareEnvironmentAsync(EnvironmentType e
{
case EnvironmentType.Local:
{
// set OLLAMA_HOST=10.10.0.125:11434
// set OLLAMA_HOST=10.10.5.85:11434
// ollama serve
var apiClient = new OllamaApiClient(
httpClient: new HttpClient
{
Timeout = TimeSpan.FromMinutes(10),
},
baseUri: new Uri("http://10.10.0.125:11434/api"));
baseUri: new Uri("http://10.10.5.85:11434/api"));

if (!string.IsNullOrEmpty(model))
{
Expand Down

0 comments on commit 744304b

Please sign in to comment.