Skip to content

Conversation

@keenborder786
Copy link
Contributor

@keenborder786 keenborder786 commented Dec 4, 2025

Issue: #34207
Description: Log probabilities have been enabled. The _chat method already returns a logprobs field (see source), which is inserted into generation_info and metadata is updated accordingly. Only the parameters need to be added to activate this feature.

@keenborder786 keenborder786 marked this pull request as draft December 4, 2025 23:30
@github-actions github-actions bot added integration Related to a provider partner package integration ollama feature labels Dec 4, 2025
@codspeed-hq
Copy link

codspeed-hq bot commented Dec 4, 2025

CodSpeed Performance Report

Merging #34218 will not alter performance

Comparing keenborder786:feat/ollama_log_probs (7ee250a) with master (dff229d)1

Summary

✅ 1 untouched
⏩ 33 skipped2

Footnotes

  1. No successful run was found on master (2aa0555) during the generation of this report, so dff229d was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

  2. 33 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@github-actions github-actions bot removed the feature label Dec 7, 2025
@keenborder786 keenborder786 marked this pull request as ready for review December 7, 2025 22:45
@paascorb
Copy link

paascorb commented Dec 8, 2025

Hi there, KeenBorder.

It's my first time doing a pull request in a Github public repository and maybe you can help me. I've checked your modification in order to make my code work but it is harder than just add the params "logprobs" and "top_logprobs" to the constructor. I've modify the file with and it is working with the UQLM library. I needed to modify the functions "_chat_stream_with_aggregation" and "_iterate_over_stream" and its async counterparts in order to make it work.

Here is the modified version:
chat_models(1).py

It is not finished yet because the top_logprobs does not work, but my plan is to finish it. How can I create the pull request when I have finished the job?

Regards,
Pablo

@keenborder786
Copy link
Contributor Author

@paascorb I saw your modification, you need to pass logprobs and top_logprobs NOT in options but direct in params. Pleasee see

@paascorb
Copy link

paascorb commented Dec 8, 2025

Hi there @keenborder786 Thanks for your replies.

With your solution I get:

imagen

With mine I get:

imagen

Regards,
Pablo

@paascorb
Copy link

paascorb commented Dec 8, 2025

I've modify the last part to make the top_logprobs work if you want to check it out.

chat_models.zip

Thanks in advance,

Pablo

@keenborder786
Copy link
Contributor Author

@paascorb, I liked your approach better since it is synced with how we are getting other params. I have modified.

@paascorb
Copy link

paascorb commented Dec 9, 2025

Hi @keenborder786 , the key is that it is not only necessary to add the parameters from the constructor, but also to receive the logprobs in each chunk. Please see the methods _chat_stream_with_aggregation and _iterate_over_stream. Especially lines 1089, 1090 and 1091.

@keenborder786
Copy link
Contributor Author

It will be passed through _chat_params

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature integration Related to a provider partner package integration ollama

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants