格式转换
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -51,7 +51,7 @@ class Evaluator:
|
||||
|
||||
# 格式化选择项
|
||||
formatted_choices = " ".join([f"({lbl}) {txt}" for lbl, txt in zip(label, text)])
|
||||
user_input = f"{question} {formatted_choices}. {prompt}"
|
||||
user_input = f"{prompt} \n {question} {formatted_choices}"
|
||||
|
||||
# 获取LLM响应
|
||||
llm_answer = self.llm_client.get_response(user_input, self.system_prompt)
|
||||
|
||||
@@ -48,14 +48,27 @@ class LLMClient:
|
||||
retries = 0
|
||||
while retries < self.max_retries:
|
||||
try:
|
||||
response = self.client.chat.completions.create(
|
||||
model=self.model,
|
||||
messages=[
|
||||
if system_prompt == 'None':
|
||||
messages = [
|
||||
{"role": "user", "content": user_input}
|
||||
]
|
||||
else:
|
||||
messages = [
|
||||
{"role": "system", "content": system_prompt},
|
||||
{"role": "user", "content": user_input}
|
||||
],
|
||||
temperature=self.temperature
|
||||
)
|
||||
]
|
||||
|
||||
if self.temperature == -1:
|
||||
response = self.client.chat.completions.create(
|
||||
model=self.model,
|
||||
messages=messages,
|
||||
)
|
||||
else:
|
||||
response = self.client.chat.completions.create(
|
||||
model=self.model,
|
||||
messages=messages,
|
||||
temperature=self.temperature
|
||||
)
|
||||
answer = response.choices[0].message.content
|
||||
return answer
|
||||
|
||||
|
||||
Reference in New Issue
Block a user