ollama-python icon indicating copy to clipboard operation
ollama-python copied to clipboard

Is logprobs supported in chat()? If not, can it be added?

Open Rakshith2202 opened this issue 8 months ago • 2 comments

Is there currently any support for retrieving logprobs in the chat() API or other Ollama endpoints? I have tried passing a parameter like "logprobs": 1 in my request, but it does not seem to return token-level probabilities, nor is it documented.

If this is not supported yet, I would like to request it as a feature.

Rakshith2202 avatar May 19 '25 07:05 Rakshith2202

We don't have logprobs supported yet but are looking into getting that ball rolling again!

ParthSareen avatar May 21 '25 05:05 ParthSareen

I've been trying to run the example code "chat-logprobs.py" but it fails on line 8 ('NoneType' object is not iterable) due to the variable named 'logprobs' being null. 8 [for entry in logprobs:]

From this thread, I'm guessing the example is not yet ready for use, but I'd love to know if there is something I should be doing differently.

aztecman avatar Nov 24 '25 20:11 aztecman