Skip to content

Commit

Permalink
introduce open api config
Browse files Browse the repository at this point in the history
  • Loading branch information
tarishij17 committed Jan 27, 2025
1 parent 2039439 commit 21642df
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion mem0/llms/litellm.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import json
import os
from typing import Dict, List, Optional

try:
Expand All @@ -16,7 +17,8 @@ def __init__(self, config: Optional[BaseLlmConfig] = None):

if not self.config.model:
self.config.model = "gpt-4o-mini"

if not self.config.api_key:
self.config.api_key = os.environ["OPENAI_API_KEY"]
def _parse_response(self, response, tools):
"""
Process the response based on whether tools are used or not.
Expand Down Expand Up @@ -75,6 +77,7 @@ def generate_response(
"temperature": self.config.temperature,
"max_tokens": self.config.max_tokens,
"top_p": self.config.top_p,
"api_key": self.config.api_key,
}
if response_format:
params["response_format"] = response_format
Expand Down

0 comments on commit 21642df

Please sign in to comment.