Skip to content

Commit

Permalink
added api_key in init arg
Browse files Browse the repository at this point in the history
  • Loading branch information
dillonalaird committed Apr 5, 2024
1 parent 4821367 commit 78971c4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion vision_agent/llm/llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,15 @@ class OpenAILLM(LLM):
def __init__(
self,
model_name: str = "gpt-4-turbo-preview",
api_key: str = "",
json_mode: bool = False,
**kwargs: Any
):
self.model_name = model_name
self.client = OpenAI()
if api_key:
self.client = OpenAI(api_key=api_key)
else:
self.client = OpenAI()
self.kwargs = kwargs
if json_mode:
self.kwargs["response_format"] = {"type": "json_object"}
Expand Down
6 changes: 5 additions & 1 deletion vision_agent/lmm/lmm.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,16 @@ class OpenAILMM(LMM):
def __init__(
self,
model_name: str = "gpt-4-vision-preview",
api_key: str = "",
max_tokens: int = 1024,
**kwargs: Any,
):
self.model_name = model_name
self.max_tokens = max_tokens
self.client = OpenAI()
if api_key:
self.client = OpenAI(api_key=api_key)
else:
self.client = OpenAI()
self.kwargs = kwargs

def __call__(
Expand Down

0 comments on commit 78971c4

Please sign in to comment.