44
55import os
66from dataclasses import dataclass , field
7- from typing import Optional , Any , Dict
7+ from typing import Any , Dict , Optional
88
99
1010@dataclass
1111class OpenAIConfig :
1212 """Configuration for OpenAI API access."""
13+
1314 api_key : Optional [str ] = field (default_factory = lambda : os .environ .get ("OPENAI_API_KEY" ))
1415 model : str = "gpt-4o"
1516 temperature : float = 0.7
@@ -19,39 +20,38 @@ class OpenAIConfig:
1920 def __post_init__ (self ):
2021 if not self .api_key :
2122 raise ValueError (
22- "OpenAI API key not found. "
23- "Set OPENAI_API_KEY environment variable or pass api_key directly."
23+ "OpenAI API key not found. Set OPENAI_API_KEY environment variable or pass api_key directly."
2424 )
2525
2626
2727@dataclass
2828class AnthropicConfig :
2929 """Configuration for Anthropic API access."""
30+
3031 api_key : Optional [str ] = field (default_factory = lambda : os .environ .get ("ANTHROPIC_API_KEY" ))
3132 model : str = "claude-3-opus-20240229"
3233 temperature : float = 0.7
33- max_tokens : int = 1000 # Corresponds to Anthropic's max_tokens_to_sample
34+ max_tokens : int = 1000 # Corresponds to Anthropic's max_tokens_to_sample
3435
3536 def __post_init__ (self ):
3637 if not self .api_key :
3738 raise ValueError (
38- "Anthropic API key not found. "
39- "Set ANTHROPIC_API_KEY environment variable or pass api_key directly."
39+ "Anthropic API key not found. Set ANTHROPIC_API_KEY environment variable or pass api_key directly."
4040 )
4141
4242
4343@dataclass
4444class GoogleConfig :
4545 """Configuration for Google Generative AI API access."""
46+
4647 api_key : Optional [str ] = field (default_factory = lambda : os .environ .get ("GOOGLE_API_KEY" ))
4748 model : str = "gemini-1.5-pro-latest"
4849 temperature : Optional [float ] = 0.7
49- max_output_tokens : Optional [int ] = 1000 # Corresponds to Gemini's max_output_tokens
50+ max_output_tokens : Optional [int ] = 1000 # Corresponds to Gemini's max_output_tokens
5051 model_kwargs : Optional [Dict [str , Any ]] = field (default_factory = dict )
5152
5253 def __post_init__ (self ):
5354 if not self .api_key :
5455 raise ValueError (
55- "Google API key not found. "
56- "Set GOOGLE_API_KEY environment variable or pass api_key directly."
57- )
56+ "Google API key not found. Set GOOGLE_API_KEY environment variable or pass api_key directly."
57+ )
0 commit comments