parent
a7efe0ee00
commit
20f8403f36
Binary file not shown.
Binary file not shown.
@ -0,0 +1,6 @@
|
||||
from Util import LlmUtil
|
||||
|
||||
if __name__ == '__main__':
|
||||
query_text = '你是谁?'
|
||||
response = LlmUtil.get_llm_response(query_text)
|
||||
print(response)
|
@ -0,0 +1,15 @@
|
||||
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
|
Binary file not shown.
Loading…
Reference in new issue