You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
498 B
15 lines
498 B
from openai import OpenAI
|
|
from Config.Config import *
|
|
|
|
def get_llm_response(query_text:str):
|
|
# 获取大模型的响应
|
|
client = OpenAI(
|
|
api_key=LLM_API_KEY,
|
|
base_url=LLM_BASE_URL,
|
|
)
|
|
completion = client.chat.completions.create(
|
|
model=LLM_MODEL_NAME,
|
|
messages=[{'role': 'system', 'content': 'You are a helpful assistant.'},
|
|
{'role': 'user', 'content': query_text}]
|
|
)
|
|
return completion.choices[0].message.content |