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

Missing parameter "format" in GenerateCompletionRequest #19

Closed
Puresoft opened this issue Feb 2, 2024 · 4 comments
Closed

Missing parameter "format" in GenerateCompletionRequest #19

Puresoft opened this issue Feb 2, 2024 · 4 comments

Comments

@Puresoft
Copy link

Puresoft commented Feb 2, 2024

Hi, I'm missing the format parameter for JSON mode in the GenerateCompletionRequest class.

DOC: https://github.com/ollama/ollama/blob/main/docs/api.md

I'm using JSON mode for long running request, 1 request will take up to 5 minutes.
Is there a way to set the timeout?

@awaescher
Copy link
Owner

You mean this one?

format: the format to return a response in. Currently the only accepted value is json

As it does not support any other values than json it is not part of the model.

As for the timeout, you should be able to simply cancel any operation with a CancellationToken.

@Puresoft
Copy link
Author

Puresoft commented Feb 2, 2024

timeout

I mean, my request take long by design, I'm not using ollama as a chatbot.
Your http request times out before the request has finished and I want to extend the timeout.
I solved it for now by passing my own instance of HttpClient to the OllamaApiClient constructor.

JSON mode

Yes, but it is an optional parameter and you have to provide it if you want to use it right?

Enable JSON mode by setting the format parameter to json. This will structure the response as a valid JSON object. See the JSON >mode example below.

When format is set to json, the output will always be a well-formed JSON object. It's important to also instruct the model to >respond in JSON.

@awaescher
Copy link
Owner

timeout
You can preconfigure your HttpClient as you wish and pass it as constructor argument to the OllamaApiClient. Don't forget to set the BaseAddress on it if doing so.

JSON mode
Understood. Might implement this.

@awaescher
Copy link
Owner

Fixed with #22

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

No branches or pull requests

2 participants