Spaces:
Running
Running
Commit ยท
f6000f0
1
Parent(s): 40b8c49
- requirements.txt +1 -0
- routers/llm_router.py +11 -2
requirements.txt
CHANGED
|
@@ -6,3 +6,4 @@ python-jose[cryptography]
|
|
| 6 |
pydantic
|
| 7 |
sqlalchemy
|
| 8 |
psycopg[binary]
|
|
|
|
|
|
| 6 |
pydantic
|
| 7 |
sqlalchemy
|
| 8 |
psycopg[binary]
|
| 9 |
+
requests
|
routers/llm_router.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
| 1 |
"""
|
| 2 |
https://chatgpt.com/share/6a03d706-d848-83a9-b06d-d0a7fb83b79d
|
| 3 |
"""
|
|
|
|
| 4 |
from fastapi import APIRouter, Form, File, UploadFile
|
| 5 |
from utils.common import CommonResponse
|
| 6 |
from utils.db import get_connection
|
|
@@ -53,7 +54,12 @@ def test_home(userquery: str = Form("")):
|
|
| 53 |
"messages": [
|
| 54 |
{
|
| 55 |
"role": "system",
|
| 56 |
-
"content": "
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
},
|
| 58 |
{
|
| 59 |
"role": "user",
|
|
@@ -61,7 +67,7 @@ def test_home(userquery: str = Form("")):
|
|
| 61 |
}
|
| 62 |
],
|
| 63 |
"temperature": 0.8,
|
| 64 |
-
"max_tokens":
|
| 65 |
"stream": False
|
| 66 |
}
|
| 67 |
|
|
@@ -76,6 +82,9 @@ def test_home(userquery: str = Form("")):
|
|
| 76 |
)
|
| 77 |
|
| 78 |
result = response.json()
|
|
|
|
|
|
|
|
|
|
| 79 |
|
| 80 |
# 5. AI ์๋ต ํ
์คํธ ๊บผ๋ด๊ธฐ
|
| 81 |
answer = result["choices"][0]["message"]["content"]
|
|
|
|
| 1 |
"""
|
| 2 |
https://chatgpt.com/share/6a03d706-d848-83a9-b06d-d0a7fb83b79d
|
| 3 |
"""
|
| 4 |
+
import requests
|
| 5 |
from fastapi import APIRouter, Form, File, UploadFile
|
| 6 |
from utils.common import CommonResponse
|
| 7 |
from utils.db import get_connection
|
|
|
|
| 54 |
"messages": [
|
| 55 |
{
|
| 56 |
"role": "system",
|
| 57 |
+
"content": """
|
| 58 |
+
๋น์ ์ ์น์ ํ ํ๋ก ์๋ด์ฌ์
๋๋ค.
|
| 59 |
+
๋ฐ๋์ ํ๊ตญ์ด๋ก ๋ต๋ณํ์ธ์.
|
| 60 |
+
๋ต๋ณ์ 5๋ฌธ์ฅ ์ด๋ด๋ก ์งง๊ฒ ํ์ธ์.
|
| 61 |
+
๋ณต์กํ ์ค๋ช
์ ํ์ง ๋ง์ธ์.
|
| 62 |
+
"""
|
| 63 |
},
|
| 64 |
{
|
| 65 |
"role": "user",
|
|
|
|
| 67 |
}
|
| 68 |
],
|
| 69 |
"temperature": 0.8,
|
| 70 |
+
"max_tokens": 4000,
|
| 71 |
"stream": False
|
| 72 |
}
|
| 73 |
|
|
|
|
| 82 |
)
|
| 83 |
|
| 84 |
result = response.json()
|
| 85 |
+
print("========== Pollinations raw result ==========")
|
| 86 |
+
print(result)
|
| 87 |
+
print("============================================")
|
| 88 |
|
| 89 |
# 5. AI ์๋ต ํ
์คํธ ๊บผ๋ด๊ธฐ
|
| 90 |
answer = result["choices"][0]["message"]["content"]
|