-
Notifications
You must be signed in to change notification settings - Fork 541
Reference Models Centrally, set OpenAI Model to gpt-5-nano and Updated Example #3792
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
Conversation
This pull request has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in 7 days if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions! |
Perhaps 4.1 nano or mini could also now be considered, as 4o-mini has been retired from OpenAI and will retire in September 2025 in Azure. |
@giterinhub you probably want to actually change https://github.com/dapr/components-contrib/blame/main/conversation/openai/openai.go#L44 that is the "real" default, as Metadata.yaml is more like a reference. Also the description in the metadata.yaml would need to change to reflect the default |
Hey @giterinhub - mind fixing the conflicts? |
Signed-off-by: Erin La <107987318+giterinhub@users.noreply.github.com>
Consistently changed all references to OpenAI models to use "gpt-4.1-nano". |
This pull request has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in 7 days if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions! |
This pull request has been automatically closed because it has not had activity in the last 37 days. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions! |
Hey @giterinhub - I just noticed the daprbot closed this... Mind fixing the conflicts again? |
@giterinhub probably this could now be updated to gpt-5 |
@giterinhub - PTAL and update this PR |
…tion - Add conversation/models.go with centralized model constants using env vars - Update all conversation providers (OpenAI, Anthropic, Google AI, Mistral, HuggingFace, Ollama) to use centralized models - Replace hardcoded model values in config files with environment variables - Update metadata.yaml files to document environment variable usage - Enhance README.md with comprehensive environment variable documentation - Maintain backward compatibility with sensible fallback defaults This enables runtime model configuration without code changes, supporting different models per environment (dev/staging/prod) and infrastructure-as-code Signed-off-by: Erin La <107987318+giterinhub@users.noreply.github.com>
…tion - Add conversation/models.go with centralized model constants using env vars - Update all conversation providers (OpenAI, Anthropic, Google AI, Mistral, HuggingFace, Ollama) to use centralized models - Replace hardcoded model values in config files with environment variables - Update metadata.yaml files to document environment variable usage - Enhance README.md with comprehensive environment variable documentation - Maintain backward compatibility with sensible fallback defaults This enables runtime model configuration without code changes, supporting different models per environment (dev/staging/prod) and infrastructure-as-code deployments. Signed-off-by: Erin La <107987318+giterinhub@users.noreply.github.com>
…tion - Add conversation/models.go with centralized model constants using env vars - Update all conversation providers (OpenAI, Anthropic, Google AI, Mistral, HuggingFace, Ollama) to use centralized models - Replace hardcoded model values in config files with environment variables - Update metadata.yaml files to document environment variable usage - Enhance README.md with comprehensive environment variable documentation - Maintain backward compatibility with sensible fallback defaults This enables runtime model configuration without code changes, supporting different models per environment (dev/staging/prod) and infrastructure-as-code deployments. Signed-off-by: Erin La <107987318+giterinhub@users.noreply.github.com>
Signed-off-by: Erin La <107987318+giterinhub@users.noreply.github.com>
…ed anthropic and google model to latest defaults Signed-off-by: Erin La <107987318+giterinhub@users.noreply.github.com>
can you please try running the conformance tests as shown in https://github.com/dapr/components-contrib/blob/fa9ace4ebf8d99d3b124906ca0cf2881b9d72709/tests/config/conversation/README.md. I checked it out and it shows issues, like all the |
- Add centralized model management in conversation/models.go with default constants - Implement Get*Model() functions supporting metadata > env var > default fallback - Update all conversation providers (openai, anthropic, googleai, mistral, huggingface, ollama) to use centralized model getters - Add Azure OpenAI model support with AZURE_OPENAI_MODEL env var - Update test configurations to use optional environment variables with empty string fallbacks - Enhance test framework to support ${{ENV_VAR||}} syntax for optional env vars - Remove hardcoded model defaults from test configs, allowing Go code defaults to be used This enables flexible model configuration: specified in metadata, environment variables, or fallback to sensible Signed-off-by: Erin La <107987318+giterinhub@users.noreply.github.com>
I'm out of credits for the openai API platform, but the tests seem to work now. |
tested locally and it did work for the providers. One thing I noticed that I think i've seen before, on gpt-5 temperature should not be provided or be set to 1, or we get an error like. By default we don't provide it but langchaing go still sends the zero value default and we get: Error Trace: components-contrib/tests/conformance/conversation/conversation.go:84
Error: Received unexpected error:
API returned unexpected status code: 400: Unsupported value: 'temperature' does not support 0 with this model. Only the default (1) value is supported.
Test: TestConversationConformance/openai.openai/converse/get_a_non-empty_response_without_errors There is a fix in langchaingo main branch tmc/langchaingo#1374 but it is not in a release tag for now, not sure we want to wait for it or not @sicoyle ?? So it would be good to put a comment about this restriction somewhere, that for now (until we update langchainggo) we should add Temperature: 1 to the request. For example in the conformance test file https://github.com/dapr/components-contrib/blob/8d675f486059f77f21b2f0ad7cd303b914d85cbd/tests/conformance/conversation/conversation.go, every request: req1 := &conversation.Request{
Message: &messages,
Tools: &tools,
} should be written as
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
few last comments. Thank you for working through a few review cycles with us on this, but I think it is super close 🎉 🙌
* Conditionally set Temperature=1 for OpenAI models to avoid unsupported temperature=0 * Preserve default behavior for other providers (Grok, Gemini, Anthropic, DeepSeek) * Reference upstream langchaingo fix: tmc/langchaingo#1374 Signed-off-by: Erin La <107987318+giterinhub@users.noreply.github.com>
…mprove documentation Signed-off-by: Erin La <107987318+giterinhub@users.noreply.github.com>
- Add environment variable references to all model descriptions - Update defaults to match models.go constants - Fix environment variable names in examples - Remove typo in OpenAI description Signed-off-by: Erin La <107987318+giterinhub@users.noreply.github.com>
…l retrieval functions Signed-off-by: Erin La <107987318+giterinhub@users.noreply.github.com>
@giterinhub Hi - thanks for being so quick to address feedback :) I am monitoring your PR in my email notifications so I can rereview asap for ya! I was curious if there were any issues with letting the conformance tests use the default vals on the model field in the test config instead of the || suffix approach? |
Hi Sam, thanks for your attention. I had issues when the environment variables weren't set, and needed a way to reference both the environment variables and the default variables, and this seems the most elegant way... |
…efaults - Set model value to empty string in all provider YAML test configs (openai, azure, anthropic, googleai, mistral, huggingface, ollama) Signed-off-by: Erin La <107987318+giterinhub@users.noreply.github.com>
Signed-off-by: Erin Lalor <107987318+giterinhub@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
final comments from me - thank you!!
- Swap getModel() order: metadatav> env var > default - Remove || syntax from test framework - Update metadata.yaml examples to use actual defaults Signed-off-by: Erin La <107987318+giterinhub@users.noreply.github.com>
…iable value Signed-off-by: Erin La <107987318+giterinhub@users.noreply.github.com>
thank you for your efforts and contribution! once build is green we can look to merge 🙌 |
…d Example (dapr#3792) Signed-off-by: Erin La <107987318+giterinhub@users.noreply.github.com> Signed-off-by: Erin Lalor <107987318+giterinhub@users.noreply.github.com>
Description
This PR implements a comprehensive centralized model management system for all conversation components, providing runtime flexibility and infrastructure-as-code capabilities.
What Changed
🎯 Centralized Model Management
conversation/models.go
with environment variable-driven model constants🔧 Environment Variable Configuration
OPENAI_MODEL
(default: gpt-5-nano)AZURE_OPENAI_MODEL
(default: gpt-4.1-mini)ANTHROPIC_MODEL
(default: claude-sonnet-4-20250514)GOOGLEAI_MODEL
(default: gemini-2.5-flash-lite)MISTRAL_MODEL
(default: open-mistral-7b)HUGGINGFACE_MODEL
(default: deepseek-ai/DeepSeek-R1-Distill-Qwen-32B)OLLAMA_MODEL
(default: llama3.2:latest)📁 Updated Files
conversation/models.go
(new centralized constants)Benefits
🚀 Runtime Flexibility: Change models without rebuilding/redeploying
🏗️ Infrastructure as Code: Configure models in Docker, Kubernetes, CI/CD
📋 Environment-Specific: Different models for dev/staging/prod
🛡️ Backward Compatible: Sensible defaults when env vars not set
🎯 Future-Proof: Single point of control for model updates
Usage Examples
Checklist
Please make sure you've completed the relevant tasks for this PR, out of the following list: