Skip to content

Commit

Permalink
add accurate costs
Browse files Browse the repository at this point in the history
  • Loading branch information
ericcccsliu committed Mar 31, 2024
1 parent 8bbfa8c commit 33f04ed
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 6 deletions.
Binary file modified api/utils/__pycache__/llm_provider_info.cpython-311.pyc
Binary file not shown.
10 changes: 5 additions & 5 deletions api/utils/llm_provider_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ def __init__(self, model_name: str, model_provider: str, display_name: str, inpu
self.is_flagship = is_flagship

LLM_PROVIDERS = [
LLMProvider("gpt-4-0125-preview", "openai", "gpt-4 turbo", 0.03 / 1000, 0.06 / 1000, True),
LLMProvider("gpt-3.5-turbo-0125", "openai", "gpt-3.5 turbo", 0.002 / 1000, 0.002 / 1000, False),
LLMProvider("claude-3-opus-20240229", "anthropic", "claude 3 opus", 0.02 / 1000, 0.04 / 1000, True),
LLMProvider("claude-3-sonnet-20240229", "anthropic", "claude 3 sonnet", 0.001 / 1000, 0.001 / 1000, False),
LLMProvider("claude-3-haiku-20240307", "anthropic", "claude 3 haiku", 0.001 / 1000, 0.001 / 1000, False),
LLMProvider("gpt-4-0125-preview", "openai", "gpt-4 turbo", 10 / 1000000, 30 / 1000000, True),
LLMProvider("gpt-3.5-turbo-0125", "openai", "gpt-3.5 turbo", 0.50 / 1000000, 1.50 / 1000000, False),
LLMProvider("claude-3-opus-20240229", "anthropic", "claude 3 opus", 15 / 1000000, 75 / 1000000, True),
LLMProvider("claude-3-sonnet-20240229", "anthropic", "claude 3 sonnet", 3 / 1000000, 15 / 1000000, False),
LLMProvider("claude-3-haiku-20240307", "anthropic", "claude 3 haiku", 0.25 / 1000000, 1.25 / 1000000, False),
]
Binary file modified api/utils/llm_providers/__pycache__/anthropic.cpython-311.pyc
Binary file not shown.
Binary file modified api/utils/llm_providers/__pycache__/openai.cpython-311.pyc
Binary file not shown.
2 changes: 1 addition & 1 deletion api/utils/llm_providers/anthropic.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ async def anthropic_generate_response(conversation):
stream = await client.messages.create(
model=conversation.model.name,
messages=messages,
max_tokens=1024,
max_tokens=1500,
stream=True,
)

Expand Down
1 change: 1 addition & 0 deletions api/utils/llm_providers/openai.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ async def openai_generate_response(conversation):
input_tokens = sum(len(encoding.encode(message["content"])) for message in messages)

stream = await client.chat.completions.create(
max_tokens=1500,
model=conversation.model.name,
messages=messages,
stream=True,
Expand Down

0 comments on commit 33f04ed

Please sign in to comment.