xulh
commited on
Commit
·
7f611b8
1
Parent(s):
9fd5bac
代码初始化
Browse files- inference/inference.py +3 -3
inference/inference.py
CHANGED
@@ -58,7 +58,7 @@ async def chat_completion(token: str = Body(...), messages: list = Body(...)):
|
|
58 |
try:
|
59 |
# 创建 InferenceClient
|
60 |
client = InferenceClient(api_key=token)
|
61 |
-
|
62 |
messages.append({
|
63 |
"role": "system",
|
64 |
"content": "You are a multilingual chatbot capable of understanding questions in various languages and "
|
@@ -66,9 +66,9 @@ async def chat_completion(token: str = Body(...), messages: list = Body(...)):
|
|
66 |
"answered in Chinese."
|
67 |
})
|
68 |
|
69 |
-
# 使用 chat API 请求生成模型的回答
|
70 |
completion = client.chat.completions.create(
|
71 |
-
model="
|
72 |
messages=messages,
|
73 |
max_tokens=500
|
74 |
)
|
|
|
58 |
try:
|
59 |
# 创建 InferenceClient
|
60 |
client = InferenceClient(api_key=token)
|
61 |
+
print("问题:", messages)
|
62 |
messages.append({
|
63 |
"role": "system",
|
64 |
"content": "You are a multilingual chatbot capable of understanding questions in various languages and "
|
|
|
66 |
"answered in Chinese."
|
67 |
})
|
68 |
|
69 |
+
# 使用 chat API 请求生成模型的回答 备选模型 google/gemma-2-2b-it
|
70 |
completion = client.chat.completions.create(
|
71 |
+
model="mistralai/Mistral-Nemo-Instruct-2407",
|
72 |
messages=messages,
|
73 |
max_tokens=500
|
74 |
)
|