Skip to content

feat(generative): expose n on the OpenAI runtime config - #2125

Open
Anai-Guo wants to merge 1 commit into
weaviate:mainfrom
Anai-Guo:feat/generative-openai-n
Open

feat(generative): expose n on the OpenAI runtime config#2125
Anai-Guo wants to merge 1 commit into
weaviate:mainfrom
Anai-Guo:feat/generative-openai-n

Conversation

@Anai-Guo

Copy link
Copy Markdown
Contributor

What / why

GenerativeConfig.openai() and GenerativeConfig.azure_openai() build a
_GenerativeOpenAI runtime config that exposes most OpenAI generation
parameters (temperature, top_p, frequency_penalty, presence_penalty,
max_tokens, stop, …) but omits n — the number of sequences to
generate.

The gRPC GenerativeOpenAI proto message already carries an n field, and
the sibling GenerativeConfig.databricks() runtime config already exposes it
the 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 n to:

  • the _GenerativeOpenAI pydantic model,
  • its _to_grpc() mapping (n=self.n),
  • the openai() and azure_openai() factory signatures + docstrings.

Additive only (8 lines, no deletions); mirrors the existing databricks()
wiring exactly. None keeps the current behaviour (server default).

🤖 Generated with Claude Code

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.

@orca-security-eu orca-security-eu Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Orca Security Scan Summary

Status Check Issues by priority
Passed Passed Infrastructure as Code high 0   medium 0   low 0   info 0 View in Orca
Passed Passed SAST high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Secrets high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Vulnerabilities high 0   medium 0   low 0   info 0 View in Orca

@weaviate-git-bot

Copy link
Copy Markdown

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.

beep boop - the Weaviate bot 👋🤖

PS:
Are you already a member of the Weaviate Forum?

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.

2 participants