You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When you add custom model for ollama (with id "custom" for example) provider trying to pull this model and failed
Steps to reproduce the bug
Steps to reproduce:
Create custom model with id="custom" for ollama
Run clean ollama server without any model loaded
Compile and run this code
using LangChain.Providers.Ollama;
using Ollama;
var provider = new OllamaProvider("http://127.0.0.1:11434/api");
var llm = new OllamaChatModel(provider, "custom");
var result = await llm.GenerateAsync("Hi!");
Actual result: provider trying to pull model "custom" and fail
Expected behavior
ollama load existed model "custom" and generate valid response
Screenshots
No response
NuGet package version
No response
Additional context
No response
The text was updated successfully, but these errors were encountered:
I think it will help if you will use ListModelsAsync instad of ListRunningModelsAsync in OllamaProvider.cs. Like this:
publicasyncTaskPullModelIfRequiredAndAllowedAsync(stringid,CancellationTokencancellationToken=default){if(!CanPullModelsAutomatically){return;}try{// Pull the model if it is not runningvarrunningModels=awaitApi.Models.ListModelsAsync(cancellationToken).ConfigureAwait(false);if(runningModels.Models!=null&&runningModels.Models.All(x =>x.Model1?.Contains(id)!=true)){awaitApi.Models.PullModelAsync(id,cancellationToken:cancellationToken).EnsureSuccessAsync().ConfigureAwait(false);}}catch(HttpRequestException){// Ignore}}
I discovered that previous version worked only when the model was really running. So it was possible to use custom models, but only when you will "wake them up" to running state. With change to ListModelsAsync I can see it list all the available models.
Describe the bug
When you add custom model for ollama (with id "custom" for example) provider trying to pull this model and failed
Steps to reproduce the bug
Steps to reproduce:
Actual result: provider trying to pull model "custom" and fail
Expected behavior
ollama load existed model "custom" and generate valid response
Screenshots
No response
NuGet package version
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: