remove debug prints

This commit is contained in:
Feng 2024-09-16 20:46:20 +00:00
parent 1e21cd520f
commit 03ab63dae5

4
ol1.py
View File

@ -15,7 +15,6 @@ OLLAMA_MODEL = os.getenv('OLLAMA_MODEL', 'llama3.1:70b')
def make_api_call(messages, max_tokens, is_final_answer=False): def make_api_call(messages, max_tokens, is_final_answer=False):
for attempt in range(3): for attempt in range(3):
try: try:
print( f'Try api call with {messages=}, {max_tokens=}, {is_final_answer=}', flush=True )
response = requests.post( response = requests.post(
f"{OLLAMA_URL}/api/chat", f"{OLLAMA_URL}/api/chat",
json={ json={
@ -29,7 +28,6 @@ def make_api_call(messages, max_tokens, is_final_answer=False):
} }
} }
) )
print( f'Got response:\n{response.json()}\n', flush=True)
response.raise_for_status() response.raise_for_status()
return json.loads(response.json()["message"]["content"]) return json.loads(response.json()["message"]["content"])
except Exception as e: except Exception as e:
@ -72,8 +70,6 @@ You MUST response using the expected json schema, and your response must be vali
messages.append({"role": "assistant", "content": json.dumps(step_data)}) messages.append({"role": "assistant", "content": json.dumps(step_data)})
print( f"Generate response update: {messages=}", flush=True )
if step_data['next_action'] == 'final_answer': if step_data['next_action'] == 'final_answer':
break break