dfdafda
Browse files- __pycache__/proxy_server.cpython-39.pyc +0 -0
- proxy_server.py +6 -23
__pycache__/proxy_server.cpython-39.pyc
CHANGED
Binary files a/__pycache__/proxy_server.cpython-39.pyc and b/__pycache__/proxy_server.cpython-39.pyc differ
|
|
proxy_server.py
CHANGED
@@ -1412,27 +1412,11 @@ async def completion(
|
|
1412 |
raise HTTPException(status_code=status, detail=error_msg)
|
1413 |
|
1414 |
|
1415 |
-
@router.post(
|
1416 |
-
|
1417 |
-
|
1418 |
-
|
1419 |
-
|
1420 |
-
data["user_key"] = key
|
1421 |
-
data["budget_manager"] = budget_manager
|
1422 |
-
data["master_key"] = master_key
|
1423 |
-
set_env_variables(data)
|
1424 |
-
# handle how users send streaming
|
1425 |
-
if 'stream' in data:
|
1426 |
-
if type(data['stream']) == str: # if users send stream as str convert to bool
|
1427 |
-
# convert to bool
|
1428 |
-
if data['stream'].lower() == "true":
|
1429 |
-
data['stream'] = True # convert to boolean
|
1430 |
-
|
1431 |
-
response = llm.completion(**data)
|
1432 |
-
if 'stream' in data and data['stream'] == True: # use generate_responses to stream responses
|
1433 |
-
return StreamingResponse(data_generator(response), media_type='text/event-stream')
|
1434 |
-
return response
|
1435 |
-
|
1436 |
@router.post(
|
1437 |
"/chat/completions",
|
1438 |
dependencies=[Depends(user_api_key_auth)],
|
@@ -2534,7 +2518,7 @@ async def config_yaml_endpoint(config_info: ConfigYAML):
|
|
2534 |
|
2535 |
print(chat_completion.choices[0].message.content)
|
2536 |
|
2537 |
-
@router.get("/
|
2538 |
async def config_yaml_endpoint(config_info: ConfigYAML):
|
2539 |
client = Groq(
|
2540 |
api_key=os.environ.get("GROQ_API_KEY"),
|
@@ -2551,7 +2535,6 @@ async def config_yaml_endpoint(config_info: ConfigYAML):
|
|
2551 |
)
|
2552 |
|
2553 |
print(chat_completion.choices[0].message.content)
|
2554 |
-
return chat_completion.choices[0].message.content
|
2555 |
|
2556 |
|
2557 |
@router.get("/test", tags=["health"])
|
|
|
1412 |
raise HTTPException(status_code=status, detail=error_msg)
|
1413 |
|
1414 |
|
1415 |
+
@router.post(
|
1416 |
+
"/v1/chat/completions",
|
1417 |
+
dependencies=[Depends(user_api_key_auth)],
|
1418 |
+
tags=["chat/completions"],
|
1419 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1420 |
@router.post(
|
1421 |
"/chat/completions",
|
1422 |
dependencies=[Depends(user_api_key_auth)],
|
|
|
2518 |
|
2519 |
print(chat_completion.choices[0].message.content)
|
2520 |
|
2521 |
+
@router.get("/openinterpreter/chat", tags=["openinterpreter"])
|
2522 |
async def config_yaml_endpoint(config_info: ConfigYAML):
|
2523 |
client = Groq(
|
2524 |
api_key=os.environ.get("GROQ_API_KEY"),
|
|
|
2535 |
)
|
2536 |
|
2537 |
print(chat_completion.choices[0].message.content)
|
|
|
2538 |
|
2539 |
|
2540 |
@router.get("/test", tags=["health"])
|