Spaces:
Sleeping
Sleeping
fixed tool
Browse files
tools.py
CHANGED
@@ -38,13 +38,13 @@ class AnswerTool(Tool):
|
|
38 |
output_type = "string"
|
39 |
|
40 |
def forward(self, question: str) -> str:
|
41 |
-
# Build chat messages
|
42 |
messages = [
|
43 |
{"role": "system", "content": SYSTEM_PROMPT},
|
44 |
{"role": "user", "content": question},
|
45 |
]
|
|
|
46 |
resp = openai.chat.completions.create(
|
47 |
-
model="gpt-
|
48 |
messages=messages,
|
49 |
temperature=0.0,
|
50 |
max_tokens=64,
|
@@ -52,5 +52,4 @@ class AnswerTool(Tool):
|
|
52 |
text = resp.choices[0].message.content.strip()
|
53 |
if "FINAL ANSWER:" in text:
|
54 |
return text.split("FINAL ANSWER:")[-1].strip()
|
55 |
-
return text
|
56 |
-
|
|
|
38 |
output_type = "string"
|
39 |
|
40 |
def forward(self, question: str) -> str:
|
|
|
41 |
messages = [
|
42 |
{"role": "system", "content": SYSTEM_PROMPT},
|
43 |
{"role": "user", "content": question},
|
44 |
]
|
45 |
+
# → qui usiamo la nuova API v1
|
46 |
resp = openai.chat.completions.create(
|
47 |
+
model="gpt-4o",
|
48 |
messages=messages,
|
49 |
temperature=0.0,
|
50 |
max_tokens=64,
|
|
|
52 |
text = resp.choices[0].message.content.strip()
|
53 |
if "FINAL ANSWER:" in text:
|
54 |
return text.split("FINAL ANSWER:")[-1].strip()
|
55 |
+
return text
|
|