File tree Expand file tree Collapse file tree 1 file changed +1
-15
lines changed Expand file tree Collapse file tree 1 file changed +1
-15
lines changed Original file line number Diff line number Diff line change 2020import  coloredlogs 
2121import  tomli 
2222from  langchain_core .callbacks .base  import  BaseCallbackHandler 
23- from  pydantic  import  SecretStr 
2423
2524logger  =  logging .getLogger (__name__ )
2625logger .setLevel (logging .INFO )
@@ -54,7 +53,6 @@ class OllamaConfig(ModelConfig):
5453@dataclass  
5554class  OpenAIConfig (ModelConfig ):
5655    base_url : str 
57-     api_key : str 
5856
5957
6058@dataclass  
@@ -118,20 +116,8 @@ def get_llm_model(
118116        from  langchain_openai  import  ChatOpenAI 
119117
120118        model_config  =  cast (OpenAIConfig , model_config )
121-         api_key  =  (
122-             model_config .api_key 
123-             if  model_config .api_key  !=  "" 
124-             else  os .getenv ("OPENAI_API_KEY" , None )
125-         )
126-         if  api_key  is  None :
127-             raise  ValueError (
128-                 "OPENAI_API_KEY is not set. Set it either in config.toml " 
129-                 "(for openai compatible apis) or as an environment variable." 
130-             )
131119
132-         return  ChatOpenAI (
133-             model = model , base_url = model_config .base_url , api_key = SecretStr (api_key )
134-         )
120+         return  ChatOpenAI (model = model , base_url = model_config .base_url )
135121    elif  vendor  ==  "aws" :
136122        from  langchain_aws  import  ChatBedrock 
137123
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments