removed temperature from agents and copilot

This commit is contained in:
arkml 2025-06-03 11:56:06 +05:30
parent d751a1f6cd
commit e1ba685e3b
3 changed files with 8 additions and 11 deletions

View file

@ -98,7 +98,6 @@ User: {last_message.content}
response = completions_client.chat.completions.create( response = completions_client.chat.completions.create(
model=PROVIDER_COPILOT_MODEL, model=PROVIDER_COPILOT_MODEL,
messages=updated_msgs, messages=updated_msgs,
temperature=0.0,
response_format={"type": "json_object"} response_format={"type": "json_object"}
) )

View file

@ -123,7 +123,6 @@ User: {last_message.content}
return completions_client.chat.completions.create( return completions_client.chat.completions.create(
model=PROVIDER_COPILOT_MODEL, model=PROVIDER_COPILOT_MODEL,
messages=updated_msgs, messages=updated_msgs,
temperature=0.0,
stream=True stream=True
) )
@ -198,4 +197,4 @@ def create_app():
if __name__ == '__main__': if __name__ == '__main__':
app = create_app() app = create_app()
print("Starting Flask server...") print("Starting Flask server...")
app.run(port=3002, host='0.0.0.0', debug=True) app.run(port=3002, host='0.0.0.0', debug=True)

View file

@ -176,7 +176,7 @@ def get_rag_tool(config: dict, complete_request: dict) -> FunctionTool:
return tool return tool
else: else:
return None return None
DEFAULT_MAX_CALLS_PER_PARENT_AGENT = 3 DEFAULT_MAX_CALLS_PER_PARENT_AGENT = 3
def get_agents(agent_configs, tool_configs, complete_request): def get_agents(agent_configs, tool_configs, complete_request):
@ -256,8 +256,7 @@ def get_agents(agent_configs, tool_configs, complete_request):
instructions=agent_instructions, instructions=agent_instructions,
handoff_description=agent_config["description"], handoff_description=agent_config["description"],
tools=new_tools, tools=new_tools,
model = model, model = model
model_settings=ModelSettings(temperature=0.0)
) )
# Set the max calls per parent agent # Set the max calls per parent agent
@ -289,7 +288,7 @@ def get_agents(agent_configs, tool_configs, complete_request):
new_agent.handoffs = [] new_agent.handoffs = []
# Look up the agent's children from the old agent and create a list called handoffs in new_agent with pointers to the children in new_agents # Look up the agent's children from the old agent and create a list called handoffs in new_agent with pointers to the children in new_agents
new_agent.handoffs = [new_agents[new_agent_name_to_index[child]] for child in new_agent_to_children[new_agent.name]] new_agent.handoffs = [new_agents[new_agent_name_to_index[child]] for child in new_agent_to_children[new_agent.name]]
print("Returning created agents") print("Returning created agents")
print("="*100) print("="*100)
return new_agents return new_agents
@ -342,11 +341,11 @@ async def run_streamed(
# Get the stream result without trace context first # Get the stream result without trace context first
stream_result = Runner.run_streamed(agent, formatted_messages) stream_result = Runner.run_streamed(agent, formatted_messages)
# If tracing is enabled, wrap the stream_events to handle tracing # If tracing is enabled, wrap the stream_events to handle tracing
if enable_tracing: if enable_tracing:
original_stream_events = stream_result.stream_events original_stream_events = stream_result.stream_events
async def wrapped_stream_events(): async def wrapped_stream_events():
# Create trace context inside the async function # Create trace context inside the async function
with trace(f"Agent turn: {agent.name}") as trace_ctx: with trace(f"Agent turn: {agent.name}") as trace_ctx:
@ -359,9 +358,9 @@ async def run_streamed(
except Exception as e: except Exception as e:
print(f"Error in stream events: {str(e)}") print(f"Error in stream events: {str(e)}")
raise raise
stream_result.stream_events = wrapped_stream_events stream_result.stream_events = wrapped_stream_events
return stream_result return stream_result
except Exception as e: except Exception as e:
print(f"Error during streaming run: {str(e)}") print(f"Error during streaming run: {str(e)}")