Skip to content

Commit

Permalink
feat(llm-proxy): Add support for other claude models + minor fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Diwank Singh Tomer <[email protected]>
  • Loading branch information
creatorrr committed Sep 7, 2024
1 parent c54f172 commit 888887a
Show file tree
Hide file tree
Showing 12 changed files with 34 additions and 11 deletions.
4 changes: 4 additions & 0 deletions agents-api/agents_api/activities/utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import json
from functools import reduce
from itertools import accumulate
from random import random
from time import time
from typing import Any, Callable

import re2
Expand Down Expand Up @@ -29,13 +31,15 @@
"match_regex": lambda pattern, string: bool(re2.fullmatch(pattern, string)),
"max": max,
"min": min,
"random": random,
"range": range,
"reduce": reduce,
"round": round,
"search_regex": lambda pattern, string: re2.search(pattern, string),
"set": set,
"str": str,
"sum": sum,
"time": time,
"tuple": tuple,
"zip": zip,
}
Expand Down
2 changes: 1 addition & 1 deletion agents-api/agents_api/models/session/get_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def get_session(
render_templates,
token_budget,
context_overflow,
@ "NOW"
@ "END"
}, updated_at = to_int(validity)
"""

Expand Down
2 changes: 1 addition & 1 deletion agents-api/agents_api/models/session/list_sessions.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def list_sessions(
metadata,
token_budget,
context_overflow,
@ "NOW"
@ "END"
}},
users_p[users, id],
participants[agents, "agent", id],
Expand Down
2 changes: 1 addition & 1 deletion agents-api/agents_api/models/session/patch_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def patch_session(
input[{session_update_cols}],
ids[session_id, developer_id],
*sessions{{
{rest_fields}, metadata: md, @ "NOW"
{rest_fields}, metadata: md, @ "END"
}},
updated_at = 'ASSERT',
metadata = concat(md, $metadata),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def prepare_session_data(
render_templates,
token_budget,
context_overflow,
@ "NOW"
@ "END"
},
updated_at = to_int(validity),
record = {
Expand Down
2 changes: 1 addition & 1 deletion agents-api/agents_api/models/session/update_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def update_session(
input[{session_update_cols}],
ids[session_id, developer_id],
*sessions{{
{rest_fields}, @ "NOW"
{rest_fields}, @ "END"
}},
updated_at = 'ASSERT'
Expand Down
2 changes: 1 addition & 1 deletion agents-api/agents_api/models/task/get_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def get_task(
workflows,
created_at,
metadata,
@ 'NOW'
@ 'END'
},
updated_at = to_int(updated_at_ms) / 1000
Expand Down
2 changes: 1 addition & 1 deletion agents-api/agents_api/models/task/list_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def list_tasks(
workflows,
created_at,
metadata,
@ 'NOW'
@ 'END'
}},
updated_at = to_int(updated_at_ms) / 1000
Expand Down
2 changes: 1 addition & 1 deletion agents-api/agents_api/models/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def mark_session_updated_query(developer_id: UUID | str, session_id: UUID | str)
render_templates,
token_budget,
context_overflow,
@ 'NOW'
@ 'END'
}},
updated_at = [floor(now()), true]
Expand Down
18 changes: 18 additions & 0 deletions llm-proxy/litellm-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,24 @@ model_list:
tags: ["paid"]
api_key: os.environ/ANTHROPIC_API_KEY

- model_name: "claude-3-opus"
litellm_params:
model: "claude-3-opus-20240229"
tags: ["paid"]
api_key: os.environ/ANTHROPIC_API_KEY

- model_name: "claude-3-sonnet"
litellm_params:
model: "claude-3-sonnet-20240229"
tags: ["paid"]
api_key: os.environ/ANTHROPIC_API_KEY

- model_name: "claude-3-haiku"
litellm_params:
model: "claude-3-haiku-20240307"
tags: ["paid"]
api_key: os.environ/ANTHROPIC_API_KEY

# Groq models
- model_name: "llama-3.1-70b"
litellm_params:
Expand Down
2 changes: 1 addition & 1 deletion memory-store/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ RUN \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

# Set fallback mount directory
ENV COZO_MNT_DIR=/data COZO_BACKUP_DIR=/backup APP_HOME=/app
ENV COZO_MNT_DIR=/data COZO_BACKUP_DIR=/backup APP_HOME=/app COZO_PORT=9070
WORKDIR $APP_HOME

# Copy the cozo binary
Expand Down
5 changes: 3 additions & 2 deletions memory-store/backup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ set -eo pipefail # Exit on error
set -u # Exit on undefined variable

# Ensure environment variables are set
if [ -z "$COZO_PORT" ] || [ -z "$COZO_AUTH_TOKEN" ]; then
echo "COZO_PORT or COZO_AUTH_TOKEN is not set"
if [ -z "$COZO_AUTH_TOKEN" ]; then
echo "COZO_AUTH_TOKEN is not set"
exit 1
fi

COZO_PORT=${COZO_PORT:-9070}
COZO_BACKUP_DIR=${COZO_BACKUP_DIR:-/backup}
TIMESTAMP=$(date +%Y-%m-%d_%H-%M-%S)
MAX_BACKUPS=${MAX_BACKUPS:-10}
Expand Down

0 comments on commit 888887a

Please sign in to comment.