forked from jgravelle/AutoGroq
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Selectable providers; add'l error handling, etc.
- Loading branch information
Showing
25 changed files
with
1,089 additions
and
602 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# User-specific configurations | ||
|
||
LLM_PROVIDER = "anthropic" | ||
ANTHROPIC_API_URL = "https://api.anthropic.com/v1/messages" | ||
GROQ_API_URL = "https://api.groq.com/openai/v1/chat/completions" | ||
LMSTUDIO_API_URL = "http://localhost:1234/v1/chat/completions" | ||
OLLAMA_API_URL = "http://127.0.0.1:11434/api/generate" | ||
# OPENAI_API_KEY = "your_openai_api_key" | ||
OPENAI_API_URL = "https://api.openai.com/v1/chat/completions" | ||
|
||
DEBUG = True | ||
|
||
RETRY_DELAY = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# config_sessions.py | ||
|
||
from datetime import datetime | ||
from typing import Dict | ||
|
||
DEFAULT_AGENT_CONFIG: Dict = { | ||
"name": "Default Agent", | ||
"description": "A default agent for initialization purposes in AutoGroq", | ||
"tools": [], # Empty list as default | ||
"config": { | ||
"llm_config": { | ||
"config_list": [ | ||
{ | ||
"model": "default", | ||
"api_key": None, | ||
"base_url": None, | ||
"api_type": None, | ||
"api_version": None, | ||
} | ||
], | ||
"temperature": 0.7, | ||
"max_tokens": 1000, | ||
"top_p": 1.0, | ||
"frequency_penalty": 0.0, | ||
"presence_penalty": 0.0, | ||
}, | ||
"human_input_mode": "NEVER", | ||
"max_consecutive_auto_reply": 10, | ||
}, | ||
"role": "Default Assistant", | ||
"goal": "Assist users with general tasks in AutoGroq", | ||
"backstory": "I am a default AI assistant created to help initialize the AutoGroq system.", | ||
"id": None, # Will be set dynamically when needed | ||
"created_at": datetime.now().isoformat(), | ||
"updated_at": datetime.now().isoformat(), | ||
"user_id": "default_user", | ||
"workflows": None, | ||
"type": "assistant", | ||
"models": [], # Empty list as default | ||
"verbose": False, | ||
"allow_delegation": True, | ||
"new_description": None, | ||
"timestamp": datetime.now().isoformat(), | ||
"is_termination_msg": None, | ||
"code_execution_config": { | ||
"work_dir": "./agent_workspace", | ||
"use_docker": False, | ||
}, | ||
"llm": None, | ||
"function_calling_llm": None, | ||
"max_iter": 25, | ||
"max_rpm": None, | ||
"max_execution_time": 600, # 10 minutes default | ||
"step_callback": None, | ||
"cache": True | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# llm_providers/anthropic_provider.py | ||
|
||
import anthropic | ||
import streamlit as st | ||
|
||
from llm_providers.base_provider import BaseLLMProvider | ||
|
||
class AnthropicProvider(BaseLLMProvider): | ||
def __init__(self, api_key, api_url=None): | ||
self.client = anthropic.Anthropic(api_key=api_key) | ||
self.api_url = api_url | ||
|
||
def send_request(self, data): | ||
try: | ||
response = self.client.messages.create( | ||
model=data['model'], | ||
max_tokens=data.get('max_tokens', 1000), | ||
temperature=data.get('temperature', st.session_state.temperature), | ||
messages=data['messages'] | ||
) | ||
return response | ||
except anthropic.APIError as e: | ||
print(f"Anthropic API error: {e}") | ||
return None | ||
|
||
def process_response(self, response): | ||
if response is not None: | ||
return { | ||
"choices": [ | ||
{ | ||
"message": { | ||
"content": response.content[0].text | ||
} | ||
} | ||
] | ||
} | ||
return None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,14 @@ | ||
|
||
from abc import ABC, abstractmethod | ||
|
||
class BaseLLMProvider(ABC): | ||
@abstractmethod | ||
def __init__(self, api_key, api_url=None): | ||
pass | ||
|
||
@abstractmethod | ||
def send_request(self, data): | ||
pass | ||
|
||
@abstractmethod | ||
def process_response(self, response): | ||
pass | ||
|
||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
import json | ||
import requests | ||
import streamlit as st | ||
|
||
from llm_providers.base_provider import BaseLLMProvider | ||
|
||
|
Oops, something went wrong.