- 
                Notifications
    You must be signed in to change notification settings 
- Fork 542
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
          
     Merged
      
      
    
  
     Merged
                    Changes from 8 commits
      Commits
    
    
            Show all changes
          
          
            17 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      8740c90
              
                updated model version consistently to "gpt-4.1-nano" in various files
              
              
                giterinhub cff0983
              
                feat: centralize model management with environment variable configura…
              
              
                giterinhub 7adfd70
              
                feat: centralize model management with environment variable configura…
              
              
                giterinhub 6931a29
              
                feat: centralize model management with environment variable configura…
              
              
                giterinhub e7a68a8
              
                feat: update model examples to use environment variable placeholders
              
              
                giterinhub 03e24a7
              
                Merge branch 'main' into main
              
              
                giterinhub 2d151c1
              
                feat: enhance model retrieval with metadata support in getters. Updat…
              
              
                giterinhub fa9ace4
              
                Merge branch 'main' of https://github.com/giterinhub/components-contrib
              
              
                giterinhub 2c99617
              
                feat: centralize conversation model management with fallback hierarchy
              
              
                giterinhub 059b3a4
              
                Fix GPT-5 temperature issue in conversation conformance tests
              
              
                giterinhub 571ebe1
              
                feat: update environment variable names for conversation models and i…
              
              
                giterinhub 4b860f4
              
                Standardize conversation component metadata with env vars and defaults
              
              
                giterinhub d4a7ae5
              
                refactor: replace getModelValue with getModel for consistency in mode…
              
              
                giterinhub 09e0376
              
                refactor: update conversation test configs to use centralized model d…
              
              
                giterinhub 0332efb
              
                Merge branch 'main' into main
              
              
                giterinhub 3f8b574
              
                fix: correct model resolution precedence and update metadata examples
              
              
                giterinhub 8c81a6e
              
                fix: reorder logic in getModel function to prioritize Environment Var…
              
              
                giterinhub File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      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
    
  
  
    
              
  
    
      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
    
  
  
    
              
  
    
      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
    
  
  
    
              
  
    
      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
    
  
  
    
              
  
    
      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
    
  
  
    
              
  
    
      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
    
  
  
    
              
  
    
      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
    
  
  
    
              
  
    
      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
    
  
  
    
              
  
    
      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
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| /* | ||
| Copyright 2024 The Dapr Authors | ||
|         
                  giterinhub marked this conversation as resolved.
              Outdated
          
            Show resolved
            Hide resolved | ||
| Licensed under the Apache License, Version 2.0 (the "License"); | ||
| you may not use this file except in compliance with the License. | ||
| You may obtain a copy of the License at | ||
|  | ||
| http://www.apache.org/licenses/LICENSE-2.0 | ||
|  | ||
| Unless required by applicable law or agreed to in writing, software | ||
| distributed under the License is distributed on an "AS IS" BASIS, | ||
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| See the License for the specific language governing permissions and | ||
| limitations under the License. | ||
| */ | ||
| package conversation | ||
|  | ||
| import ( | ||
| "os" | ||
| ) | ||
|  | ||
| // Default models for conversation components | ||
| // These can be overridden via environment variables for runtime configuration | ||
| const ( | ||
| // Environment variable names | ||
| envOpenAIModel = "DAPR_CONVERSATION_OPENAI_MODEL" | ||
| envAnthropicModel = "DAPR_CONVERSATION_ANTHROPIC_MODEL" | ||
| envGoogleAIModel = "DAPR_CONVERSATION_GOOGLEAI_MODEL" | ||
| envMistralModel = "DAPR_CONVERSATION_MISTRAL_MODEL" | ||
| envHuggingFaceModel = "DAPR_CONVERSATION_HUGGINGFACE_MODEL" | ||
| envOllamaModel = "DAPR_CONVERSATION_OLLAMA_MODEL" | ||
| ) | ||
|  | ||
| // Default model values (used as fallbacks when env vars are not set) | ||
| const ( | ||
| defaultOpenAIModel = "gpt-5-nano" // Enable GPT-5 (Preview) for all clients | ||
| defaultAnthropicModel = "claude-sonnet-4-20250514" | ||
| defaultGoogleAIModel = "gemini-2.5-flash-lite" | ||
| defaultMistralModel = "open-mistral-7b" | ||
| defaultHuggingFaceModel = "deepseek-ai/DeepSeek-R1-Distill-Qwen-32B" | ||
| defaultOllamaModel = "llama3.2:latest" | ||
| ) | ||
|  | ||
| // getEnvOrDefault returns the value of an environment variable or a default value | ||
| func getModelValue(envVar, defaultValue, metadataValue string) string { | ||
|         
                  giterinhub marked this conversation as resolved.
              Outdated
          
            Show resolved
            Hide resolved | ||
| if metadataValue != "" { | ||
| return metadataValue | ||
| } | ||
| if value := os.Getenv(envVar); value != "" { | ||
| return value | ||
| } | ||
| return defaultValue | ||
| } | ||
|  | ||
| // Example usage for model getters with metadata support: | ||
| // Pass metadataValue from your metadata file/struct, or "" if not set. | ||
| func GetOpenAIModel(metadataValue string) string { | ||
| return getModelValue(envOpenAIModel, defaultOpenAIModel, metadataValue) | ||
| } | ||
|  | ||
| func GetAnthropicModel(metadataValue string) string { | ||
| return getModelValue(envAnthropicModel, defaultAnthropicModel, metadataValue) | ||
| } | ||
|  | ||
| func GetGoogleAIModel(metadataValue string) string { | ||
| return getModelValue(envGoogleAIModel, defaultGoogleAIModel, metadataValue) | ||
| } | ||
|  | ||
| func GetMistralModel(metadataValue string) string { | ||
| return getModelValue(envMistralModel, defaultMistralModel, metadataValue) | ||
| } | ||
|  | ||
| func GetHuggingFaceModel(metadataValue string) string { | ||
| return getModelValue(envHuggingFaceModel, defaultHuggingFaceModel, metadataValue) | ||
| } | ||
|  | ||
| func GetOllamaModel(metadataValue string) string { | ||
| return getModelValue(envOllamaModel, defaultOllamaModel, metadataValue) | ||
| } | ||
  
    
      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
    
  
  
    
              
  
    
      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
    
  
  
    
              
  
    
      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
    
  
  
    
              
  
    
      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
    
  
  
    
              
  
    
      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
    
  
  
    
              
      
      Oops, something went wrong.
        
    
  
  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.
  
    
  
    
Uh oh!
There was an error while loading. Please reload this page.