mirror of
https://github.com/TheBlewish/Automated-AI-Web-Researcher-Ollama.git
synced 2025-09-01 10:10:01 +00:00
Update llm_wrapper.py
added base url
This commit is contained in:
parent
2e278f3c05
commit
e69620c03f
1 changed files with 2 additions and 1 deletions
|
@ -23,9 +23,10 @@ class LLMWrapper:
|
||||||
def _initialize_openai(self):
|
def _initialize_openai(self):
|
||||||
"""Initialize OpenAI client"""
|
"""Initialize OpenAI client"""
|
||||||
api_key = self.llm_config.get('api_key') or os.getenv('OPENAI_API_KEY')
|
api_key = self.llm_config.get('api_key') or os.getenv('OPENAI_API_KEY')
|
||||||
|
base_url = self.llm_config.get('base_url', 'https://api.openai.com/v1')
|
||||||
if not api_key:
|
if not api_key:
|
||||||
raise ValueError("OpenAI API key not found. Set it in config or OPENAI_API_KEY environment variable")
|
raise ValueError("OpenAI API key not found. Set it in config or OPENAI_API_KEY environment variable")
|
||||||
self.client = OpenAI(api_key=api_key)
|
self.client = OpenAI(api_key=api_key, base_url=base_url)
|
||||||
self.model_name = self.llm_config.get('model_name', 'gpt-4o-mini')
|
self.model_name = self.llm_config.get('model_name', 'gpt-4o-mini')
|
||||||
|
|
||||||
def generate(self, prompt, **kwargs):
|
def generate(self, prompt, **kwargs):
|
||||||
|
|
Loading…
Add table
Reference in a new issue