fix(llm): consume llm base url config with a better way (#1861)

This commit is contained in:
Mathew Shen
2024-09-24 12:35:09 +08:00
committed by GitHub
parent 56ceecb4e3
commit 8511eca03b
5 changed files with 40 additions and 6 deletions

View File

@@ -16,7 +16,7 @@ class OpenAIStructuredLLM(LLMBase):
self.config.model = "gpt-4o-2024-08-06"
api_key = self.config.api_key or os.getenv("OPENAI_API_KEY")
base_url = self.config.openai_base_url or os.getenv("OPENAI_API_BASE")
base_url = self.config.openai_base_url or os.getenv("OPENAI_API_BASE") or "https://api.openai.com/v1"
self.client = OpenAI(api_key=api_key, base_url=base_url)
def _parse_response(self, response, tools):