mirror of
https://github.com/rowboatlabs/rowboat.git
synced 2026-06-24 20:28:16 +02:00
More fixes for litellm, openrouter support
This commit is contained in:
parent
14eee3e0c3
commit
118c724ad7
8 changed files with 33 additions and 23 deletions
|
|
@ -4,11 +4,21 @@ import dotenv
|
|||
dotenv.load_dotenv()
|
||||
|
||||
PROVIDER_BASE_URL = os.getenv('PROVIDER_BASE_URL', '')
|
||||
PROVIDER_API_KEY = os.getenv('PROVIDER_API_KEY', os.getenv('OPENAI_API_KEY', ''))
|
||||
PROVIDER_DEFAULT_MODEL = os.getenv('PROVIDER_DEFAULT_MODEL', 'gpt-4.1')
|
||||
PROVIDER_API_KEY = os.getenv('PROVIDER_API_KEY')
|
||||
PROVIDER_DEFAULT_MODEL = os.getenv('PROVIDER_DEFAULT_MODEL')
|
||||
PROVIDER_COPILOT_MODEL = os.getenv('PROVIDER_COPILOT_MODEL')
|
||||
|
||||
if not PROVIDER_COPILOT_MODEL:
|
||||
PROVIDER_COPILOT_MODEL = 'gpt-4.1'
|
||||
|
||||
if not PROVIDER_API_KEY:
|
||||
raise ValueError("No LLM Provider API key found")
|
||||
PROVIDER_API_KEY = os.getenv('OPENAI_API_KEY')
|
||||
|
||||
if not PROVIDER_API_KEY:
|
||||
raise(ValueError("No LLM Provider API key found"))
|
||||
|
||||
if not PROVIDER_DEFAULT_MODEL:
|
||||
PROVIDER_DEFAULT_MODEL = 'gpt-4.1'
|
||||
|
||||
completions_client = None
|
||||
if PROVIDER_BASE_URL:
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ from pydantic import BaseModel, ValidationError
|
|||
from typing import List, Dict, Any, Literal
|
||||
import json
|
||||
from lib import AgentContext, PromptContext, ToolContext, ChatContext
|
||||
from client import PROVIDER_DEFAULT_MODEL
|
||||
from client import PROVIDER_COPILOT_MODEL
|
||||
from client import completions_client
|
||||
|
||||
class UserMessage(BaseModel):
|
||||
|
|
@ -75,7 +75,7 @@ User: {last_message.content}
|
|||
]
|
||||
|
||||
response = completions_client.chat.completions.create(
|
||||
model=PROVIDER_DEFAULT_MODEL,
|
||||
model=PROVIDER_COPILOT_MODEL,
|
||||
messages=updated_msgs,
|
||||
temperature=0.0,
|
||||
response_format={"type": "json_object"}
|
||||
|
|
|
|||
|
|
@ -153,7 +153,7 @@ You are responsible for providing delivery information to the user.
|
|||
- Do not leave the user with partial information. Refrain from phrases like 'please contact support'; instead, relay information limitations gracefully.
|
||||
'''
|
||||
|
||||
use GPT-4o as the default model for new agents.
|
||||
use {agent_model} as the default model for new agents.
|
||||
|
||||
|
||||
## Section 9: General Guidelines
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ from pydantic import BaseModel, ValidationError
|
|||
from typing import List, Dict, Any, Literal
|
||||
import json
|
||||
from lib import AgentContext, PromptContext, ToolContext, ChatContext
|
||||
from client import PROVIDER_DEFAULT_MODEL
|
||||
from client import PROVIDER_COPILOT_MODEL, PROVIDER_DEFAULT_MODEL
|
||||
from client import completions_client
|
||||
|
||||
class UserMessage(BaseModel):
|
||||
|
|
@ -71,6 +71,9 @@ def get_streaming_response(
|
|||
# add the workflow schema to the system prompt
|
||||
sys_prompt = streaming_instructions.replace("{workflow_schema}", workflow_schema)
|
||||
|
||||
# add the agent model to the system prompt
|
||||
sys_prompt = sys_prompt.replace("{agent_model}", PROVIDER_DEFAULT_MODEL)
|
||||
|
||||
# add the current workflow config to the last user message
|
||||
last_message = messages[-1]
|
||||
last_message.content = f"""
|
||||
|
|
@ -90,7 +93,7 @@ User: {last_message.content}
|
|||
]
|
||||
|
||||
return completions_client.chat.completions.create(
|
||||
model=PROVIDER_DEFAULT_MODEL,
|
||||
model=PROVIDER_COPILOT_MODEL,
|
||||
messages=updated_msgs,
|
||||
temperature=0.0,
|
||||
stream=True
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue