send along llm_version to database
This commit is contained in:
parent
f6079542f7
commit
f67cfb6d8a
@ -8,6 +8,7 @@ from utils import pprint_prompt
|
||||
|
||||
|
||||
# Actual model versions that are passed to the LLMs and stored in our logs
|
||||
# Keep in sync with s2c-saas repo & DB column `llm_version`
|
||||
class Llm(Enum):
|
||||
GPT_4_VISION = "gpt-4-vision-preview"
|
||||
CLAUDE_3_SONNET = "claude-3-sonnet-20240229"
|
||||
|
||||
@ -343,10 +343,12 @@ async def stream_code(websocket: WebSocket):
|
||||
if IS_PROD:
|
||||
# Catch any errors from sending to SaaS backend and continue
|
||||
try:
|
||||
assert exact_llm_version is not None, "exact_llm_version is not set"
|
||||
await send_to_saas_backend(
|
||||
prompt_messages,
|
||||
completion,
|
||||
payment_method=payment_method,
|
||||
llm_version=exact_llm_version,
|
||||
auth_token=params["authToken"],
|
||||
)
|
||||
except Exception as e:
|
||||
|
||||
@ -5,6 +5,7 @@ from typing import List
|
||||
import json
|
||||
|
||||
from config import BACKEND_SAAS_URL, IS_PROD
|
||||
from llm import Llm
|
||||
|
||||
|
||||
class PaymentMethod(Enum):
|
||||
@ -19,6 +20,7 @@ async def send_to_saas_backend(
|
||||
prompt_messages: List[ChatCompletionMessageParam],
|
||||
completion: str,
|
||||
payment_method: PaymentMethod,
|
||||
llm_version: Llm,
|
||||
auth_token: str | None = None,
|
||||
):
|
||||
if IS_PROD:
|
||||
@ -30,6 +32,7 @@ async def send_to_saas_backend(
|
||||
"prompt": json.dumps(prompt_messages),
|
||||
"completion": completion,
|
||||
"payment_method": payment_method.value,
|
||||
"llm_version": llm_version.value,
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user