ci: use experimental for send message tests (#2290)
Co-authored-by: Sarah Wooders <sarahwooders@gmail.com>
This commit is contained in:
@@ -132,7 +132,16 @@ class LettaAgent(BaseAgent):
|
||||
# TODO: make into a real error
|
||||
raise ValueError("No tool calls found in response, model must make a tool call")
|
||||
tool_call = response.choices[0].message.tool_calls[0]
|
||||
reasoning = [TextContent(text=response.choices[0].message.content)] # reasoning placed into content for legacy reasons
|
||||
if response.choices[0].message.reasoning_content:
|
||||
reasoning = [
|
||||
ReasoningContent(
|
||||
reasoning=response.choices[0].message.reasoning_content,
|
||||
is_native=True,
|
||||
signature=response.choices[0].message.reasoning_content_signature,
|
||||
)
|
||||
]
|
||||
else:
|
||||
reasoning = [TextContent(text=response.choices[0].message.content)] # reasoning placed into content for legacy reasons
|
||||
|
||||
persisted_messages, should_continue = await self._handle_ai_response(
|
||||
tool_call, agent_state, tool_rules_solver, response.usage, reasoning_content=reasoning
|
||||
@@ -230,7 +239,16 @@ class LettaAgent(BaseAgent):
|
||||
# TODO: make into a real error
|
||||
raise ValueError("No tool calls found in response, model must make a tool call")
|
||||
tool_call = response.choices[0].message.tool_calls[0]
|
||||
reasoning = [TextContent(text=response.choices[0].message.content)] # reasoning placed into content for legacy reasons
|
||||
if response.choices[0].message.reasoning_content:
|
||||
reasoning = [
|
||||
ReasoningContent(
|
||||
reasoning=response.choices[0].message.reasoning_content,
|
||||
is_native=True,
|
||||
signature=response.choices[0].message.reasoning_content_signature,
|
||||
)
|
||||
]
|
||||
else:
|
||||
reasoning = [TextContent(text=response.choices[0].message.content)] # reasoning placed into content for legacy reasons
|
||||
|
||||
persisted_messages, should_continue = await self._handle_ai_response(
|
||||
tool_call, agent_state, tool_rules_solver, response.usage, reasoning_content=reasoning, step_id=step_id
|
||||
|
||||
@@ -78,8 +78,8 @@ class OpenAIStreamingInterface:
|
||||
|
||||
# track usage
|
||||
if chunk.usage:
|
||||
self.input_tokens += len(chunk.usage.prompt_tokens)
|
||||
self.output_tokens += len(chunk.usage.completion_tokens)
|
||||
self.input_tokens += chunk.usage.prompt_tokens
|
||||
self.output_tokens += chunk.usage.completion_tokens
|
||||
|
||||
if chunk.choices:
|
||||
choice = chunk.choices[0]
|
||||
|
||||
@@ -261,7 +261,9 @@ class OpenAIClient(LLMClientBase):
|
||||
Performs underlying asynchronous streaming request to OpenAI and returns the async stream iterator.
|
||||
"""
|
||||
client = AsyncOpenAI(**self._prepare_client_kwargs(llm_config))
|
||||
response_stream: AsyncStream[ChatCompletionChunk] = await client.chat.completions.create(**request_data, stream=True)
|
||||
response_stream: AsyncStream[ChatCompletionChunk] = await client.chat.completions.create(
|
||||
**request_data, stream=True, stream_options={"include_usage": True}
|
||||
)
|
||||
return response_stream
|
||||
|
||||
def handle_llm_error(self, e: Exception) -> Exception:
|
||||
|
||||
Reference in New Issue
Block a user