Improvement/add getting api key from env (#1710)
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
import os
|
||||||
import json
|
import json
|
||||||
from typing import Dict, List, Optional
|
from typing import Dict, List, Optional
|
||||||
|
|
||||||
@@ -15,6 +16,9 @@ class AzureOpenAILLM(LLMBase):
|
|||||||
if not self.config.model:
|
if not self.config.model:
|
||||||
self.config.model = "gpt-4o"
|
self.config.model = "gpt-4o"
|
||||||
self.client = AzureOpenAI()
|
self.client = AzureOpenAI()
|
||||||
|
|
||||||
|
api_key = os.getenv("AZURE_OPENAI_API_KEY") or self.config.api_key
|
||||||
|
self.client = AzureOpenAI(api_key=api_key)
|
||||||
|
|
||||||
def _parse_response(self, response, tools):
|
def _parse_response(self, response, tools):
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import os
|
||||||
import json
|
import json
|
||||||
from typing import Dict, List, Optional
|
from typing import Dict, List, Optional
|
||||||
|
|
||||||
@@ -20,6 +21,9 @@ class GroqLLM(LLMBase):
|
|||||||
self.config.model = "llama3-70b-8192"
|
self.config.model = "llama3-70b-8192"
|
||||||
self.client = Groq()
|
self.client = Groq()
|
||||||
|
|
||||||
|
api_key = os.getenv("GROQ_API_KEY") or self.config.api_key
|
||||||
|
self.client = Groq(api_key=api_key)
|
||||||
|
|
||||||
def _parse_response(self, response, tools):
|
def _parse_response(self, response, tools):
|
||||||
"""
|
"""
|
||||||
Process the response based on whether tools are used or not.
|
Process the response based on whether tools are used or not.
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import os
|
||||||
import json
|
import json
|
||||||
from typing import Dict, List, Optional
|
from typing import Dict, List, Optional
|
||||||
|
|
||||||
@@ -20,6 +21,9 @@ class TogetherLLM(LLMBase):
|
|||||||
self.config.model = "mistralai/Mixtral-8x7B-Instruct-v0.1"
|
self.config.model = "mistralai/Mixtral-8x7B-Instruct-v0.1"
|
||||||
self.client = Together()
|
self.client = Together()
|
||||||
|
|
||||||
|
api_key = os.getenv("TOGETHER_API_KEY") or self.config.api_key
|
||||||
|
self.client = Together(api_key=api_key)
|
||||||
|
|
||||||
def _parse_response(self, response, tools):
|
def _parse_response(self, response, tools):
|
||||||
"""
|
"""
|
||||||
Process the response based on whether tools are used or not.
|
Process the response based on whether tools are used or not.
|
||||||
|
|||||||
Reference in New Issue
Block a user