Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example does not work #1

Closed
Neo-vortex opened this issue Nov 5, 2023 · 1 comment
Closed

Example does not work #1

Neo-vortex opened this issue Nov 5, 2023 · 1 comment

Comments

@Neo-vortex
Copy link

the example

// set up the client
var uri = new Uri("http:https://localhost:11434");
var ollama = new OllamaApiClient(uri);

// list all local models
var models = await ollama.ListLocalModels();

// stream a completion and write to the console
// keep reusing the context to keep the chat topic going
var context = await ollama.StreamCompletion("How are you today?", "llama2", context, stream => Console.WriteLine(stream.Response));

// pull a model and report progress
await ollama.PullModel("mistral", status => Console.WriteLine($"({status.Percent}%) {status.Status}"));

produces :
Cannot use local variable 'context' before it is declared

@awaescher
Copy link
Owner

awaescher commented Nov 5, 2023

Accidentially fixed it by myself at pretty much the same time. Sorry.
Passing null as context initially is perfectly fine btw, no need to preallocate the context.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants