Python: added AIAnnotation types and extra tests (#374)

* added AIAnnotation types and extra tests

* fixed typing and such

* use copy

* fix raw representation for add

* handle annotations in add

* clarified concat

* self to first
This commit is contained in:
Eduard van Valkenburg
2025-08-08 22:27:31 +02:00
committed by GitHub
Unverified
parent 8f27e63df6
commit 82d39bc1f7
8 changed files with 934 additions and 346 deletions
@@ -177,11 +177,11 @@ class OpenAIChatClientBase(OpenAIHandler, ChatClientBase):
content = choice.message if isinstance(choice, Choice) else choice.delta
if content and (tool_calls := getattr(content, "tool_calls", None)) is not None:
for tool in cast(list[ChatCompletionMessageToolCall] | list[ChoiceDeltaToolCall], tool_calls):
if tool.function:
if tool.function: # type: ignore[reportAttributeAccessIssue, union-attr]
fcc = FunctionCallContent(
call_id=tool.id if tool.id else "",
name=tool.function.name if tool.function.name else "",
arguments=tool.function.arguments if tool.function.arguments else "",
name=tool.function.name if tool.function.name else "", # type: ignore
arguments=tool.function.arguments if tool.function.arguments else "", # type: ignore
)
resp.append(fcc)