go-openai icon indicating copy to clipboard operation
go-openai copied to clipboard

feat: support topk

Open KevinZonda opened this issue 7 months ago • 3 comments

Describe the change

TopK is well-used paramater for provider which uses OpenAI-compatible API format. This commit add the top_k parameter.

Provide OpenAI documentation link Provide a relevant API doc from https://platform.openai.com/docs/api-reference

Describe your solution

Add top_k as new parameter

Tests

Additional context

Some evidence that top_k is well used

  • https://openrouter.ai/docs/api-reference/parameters
  • https://docs.vllm.ai/en/v0.6.4/dev/sampling_params.html

Issue: #641

KevinZonda avatar May 05 '25 04:05 KevinZonda

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 85.93%. Comparing base (6181fac) to head (203eb5a). Report is 8 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #989   +/-   ##
=======================================
  Coverage   85.93%   85.93%           
=======================================
  Files          43       43           
  Lines        2268     2268           
=======================================
  Hits         1949     1949           
  Misses        300      300           
  Partials       19       19           

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov[bot] avatar May 05 '25 04:05 codecov[bot]

@KevinZonda also need to add top_k for ChatCompletionRequest

rusdevops avatar Jun 17 '25 15:06 rusdevops

@sashabaranov Please have a look. Sametimes, we need the top_k

griffinqiu avatar Jun 23 '25 07:06 griffinqiu