feat(generative): expose n on the OpenAI runtime config - #2125
Open
Anai-Guo wants to merge 1 commit into
Open
Conversation
The GenerativeOpenAI proto message carries an `n` field (number of sequences to generate), and the sibling Databricks runtime config already exposes it, but GenerativeConfig.openai()/azure_openai() never did, so callers could not request more than one generation at query time. Add `n` to the _GenerativeOpenAI model, its _to_grpc() mapping, and both the openai() and azure_openai() factory methods.
There was a problem hiding this comment.
Orca Security Scan Summary
| Status | Check | Issues by priority | |
|---|---|---|---|
| Infrastructure as Code | View in Orca | ||
| SAST | View in Orca | ||
| Secrets | View in Orca | ||
| Vulnerabilities | View in Orca |
|
To avoid any confusion in the future about your contribution to Weaviate, we work with a Contributor License Agreement. If you agree, you can simply add a comment to this PR that you agree with the CLA so that we can merge. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What / why
GenerativeConfig.openai()andGenerativeConfig.azure_openai()build a_GenerativeOpenAIruntime config that exposes most OpenAI generationparameters (
temperature,top_p,frequency_penalty,presence_penalty,max_tokens,stop, …) but omitsn— the number of sequences togenerate.
The gRPC
GenerativeOpenAIproto message already carries annfield, andthe sibling
GenerativeConfig.databricks()runtime config already exposes itthe same way, so this is purely a client-side gap: callers currently cannot
request more than one generation from the OpenAI/Azure-OpenAI generative
modules at query time.
Change
Add
nto:_GenerativeOpenAIpydantic model,_to_grpc()mapping (n=self.n),openai()andazure_openai()factory signatures + docstrings.Additive only (8 lines, no deletions); mirrors the existing
databricks()wiring exactly.
Nonekeeps the current behaviour (server default).🤖 Generated with Claude Code