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
|
# 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):
|
class Llm(Enum):
|
||||||
GPT_4_VISION = "gpt-4-vision-preview"
|
GPT_4_VISION = "gpt-4-vision-preview"
|
||||||
CLAUDE_3_SONNET = "claude-3-sonnet-20240229"
|
CLAUDE_3_SONNET = "claude-3-sonnet-20240229"
|
||||||
|
|||||||
@ -343,10 +343,12 @@ async def stream_code(websocket: WebSocket):
|
|||||||
if IS_PROD:
|
if IS_PROD:
|
||||||
# Catch any errors from sending to SaaS backend and continue
|
# Catch any errors from sending to SaaS backend and continue
|
||||||
try:
|
try:
|
||||||
|
assert exact_llm_version is not None, "exact_llm_version is not set"
|
||||||
await send_to_saas_backend(
|
await send_to_saas_backend(
|
||||||
prompt_messages,
|
prompt_messages,
|
||||||
completion,
|
completion,
|
||||||
payment_method=payment_method,
|
payment_method=payment_method,
|
||||||
|
llm_version=exact_llm_version,
|
||||||
auth_token=params["authToken"],
|
auth_token=params["authToken"],
|
||||||
)
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|||||||
@ -5,6 +5,7 @@ from typing import List
|
|||||||
import json
|
import json
|
||||||
|
|
||||||
from config import BACKEND_SAAS_URL, IS_PROD
|
from config import BACKEND_SAAS_URL, IS_PROD
|
||||||
|
from llm import Llm
|
||||||
|
|
||||||
|
|
||||||
class PaymentMethod(Enum):
|
class PaymentMethod(Enum):
|
||||||
@ -19,6 +20,7 @@ async def send_to_saas_backend(
|
|||||||
prompt_messages: List[ChatCompletionMessageParam],
|
prompt_messages: List[ChatCompletionMessageParam],
|
||||||
completion: str,
|
completion: str,
|
||||||
payment_method: PaymentMethod,
|
payment_method: PaymentMethod,
|
||||||
|
llm_version: Llm,
|
||||||
auth_token: str | None = None,
|
auth_token: str | None = None,
|
||||||
):
|
):
|
||||||
if IS_PROD:
|
if IS_PROD:
|
||||||
@ -30,6 +32,7 @@ async def send_to_saas_backend(
|
|||||||
"prompt": json.dumps(prompt_messages),
|
"prompt": json.dumps(prompt_messages),
|
||||||
"completion": completion,
|
"completion": completion,
|
||||||
"payment_method": payment_method.value,
|
"payment_method": payment_method.value,
|
||||||
|
"llm_version": llm_version.value,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user