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

Multiple competions (n) #79

Merged
merged 3 commits into from
Feb 22, 2024
Merged

Multiple competions (n) #79

merged 3 commits into from
Feb 22, 2024

Conversation

svilupp
Copy link
Owner

@svilupp svilupp commented Feb 22, 2024

  • Initial support for multiple completions in one request for OpenAI-compatible API servers. Set via API kwarg n=5 and it will request 5 completions in one request, saving the network communication time and paying the prompt tokens only once. It's useful for majority voting, diversity, or challenging agentic workflows.
  • Added new fields to AIMessage and DataMessage types to simplify tracking in complex applications. Added fields:
    • cost - the cost of the query (summary per call, so count only once if you requested multiple completions in one call)
    • log_prob - summary log probability of the generated sequence, set API kwarg logprobs=true to receive it
    • run_id - ID of the AI API call
    • sample_id - ID of the sample in the batch if you requested multiple completions, otherwise sample_id==nothing (they will have the same run_id)
    • finish_reason - the reason why the AI stopped generating the sequence (eg, "stop", "length") to provide more visibility for the user

@svilupp svilupp changed the title Update lazy calls Multiple competions (n) Feb 22, 2024
Copy link

codecov bot commented Feb 22, 2024

Codecov Report

Attention: Patch coverage is 97.77778% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 92.27%. Comparing base (84f1054) to head (320fdc5).

Files Patch % Lines
src/llm_openai.jl 96.55% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #79      +/-   ##
==========================================
+ Coverage   92.02%   92.27%   +0.25%     
==========================================
  Files          36       36              
  Lines        1818     1890      +72     
==========================================
+ Hits         1673     1744      +71     
- Misses        145      146       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@svilupp svilupp merged commit 463a830 into main Feb 22, 2024
5 checks passed
@svilupp svilupp deleted the update-lazy-calls branch February 22, 2024 21:06
svilupp added a commit that referenced this pull request Nov 26, 2024
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 this pull request may close these issues.

1 participant