-
Notifications
You must be signed in to change notification settings - Fork 591
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Enhancement]: Integrate OLLAMA API Support in AI Handlers #836
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,6 +61,9 @@ def __init__(self): | |
if get_settings().get("HUGGINGFACE.API_BASE", None) and 'huggingface' in get_settings().config.model: | ||
litellm.api_base = get_settings().huggingface.api_base | ||
self.api_base = get_settings().huggingface.api_base | ||
if get_settings().get("OLLAMA.API_BASE", None) : | ||
litellm.api_base = get_settings().ollama.api_base | ||
self.api_base = get_settings().ollama.api_base | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ensure consistency in accessing settings for different APIs by using a similar pattern or method. This can improve code maintainability and readability. For instance, you might consider abstracting the settings access logic into a method if the pattern becomes more complex with additional APIs. [medium] |
||
if get_settings().get("HUGGINGFACE.REPITITION_PENALTY", None): | ||
self.repetition_penalty = float(get_settings().huggingface.repetition_penalty) | ||
if get_settings().get("VERTEXAI.VERTEX_PROJECT", None): | ||
|
@@ -150,4 +153,4 @@ async def chat_completion(self, model: str, system: str, user: str, temperature: | |
if get_settings().config.verbosity_level >= 2: | ||
get_logger().info(f"\nAI response:\n{resp}") | ||
|
||
return resp, finish_reason | ||
return resp, finish_reason |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding error handling or a default value for
OLLAMA.API_BASE
to ensure robustness in cases where the configuration might be missing or incorrect. This could prevent runtime errors and improve the application's stability. [important]