Skip to content

Conversation

quettabit
Copy link

@quettabit quettabit commented Oct 7, 2025

before:

(openai-chatkit) ➜  chatkit-python git:(main) mypy chatkit
chatkit/actions.py:26: error: "TType" is a type variable and only valid in type context  [misc]
chatkit/server.py:381: error: Incompatible types in assignment (expression has type "ThreadMetadata", variable has type "Thread")  [assignment]
chatkit/server.py:429: error: Incompatible types in assignment (expression has type "ThreadMetadata", variable has type "Thread")  [assignment]
chatkit/server.py:443: error: Incompatible types in assignment (expression has type "ThreadMetadata", variable has type "Thread")  [assignment]
chatkit/server.py:522: error: Name "item" already defined on line 490  [no-redef]
chatkit/server.py:544: error: Argument 3 to "action" of "ChatKitServer" has incompatible type "UserMessageItem | AssistantMessageItem | ClientToolCallItem | WidgetItem | WorkflowItem | TaskItem | HiddenContextItem | EndOfTurnItem"; expected "WidgetItem | None"  [arg-type]
chatkit/agents.py:389: error: Incompatible types in assignment (expression has type "ThreadCreatedEvent | ThreadUpdatedEvent | ThreadItemDoneEvent | ThreadItemAddedEvent | ThreadItemUpdated | ThreadItemRemovedEvent | ThreadItemReplacedEvent | ProgressUpdateEvent | ErrorEvent | NoticeEvent", variable has type "RawResponsesStreamEvent | RunItemStreamEvent | AgentUpdatedStreamEvent | _EventWrapper")  [assignment]
chatkit/agents.py:389: note: Items in the first union not in the second: "ThreadCreatedEvent", "ThreadUpdatedEvent", "ThreadItemDoneEvent", "ThreadItemAddedEvent", "ThreadItemUpdated", "ThreadItemRemovedEvent", "ThreadItemReplacedEvent", "ProgressUpdateEvent", "ErrorEvent", "NoticeEvent"
chatkit/agents.py:391: error: "_EventWrapper" has no attribute "type"  [attr-defined]
chatkit/agents.py:392: error: "_EventWrapper" has no attribute "type"  [attr-defined]
chatkit/agents.py:397: error: "_EventWrapper" has no attribute "item"  [attr-defined]
chatkit/agents.py:398: error: "_EventWrapper" has no attribute "item"  [attr-defined]
chatkit/agents.py:399: error: "_EventWrapper" has no attribute "item"  [attr-defined]
chatkit/agents.py:405: error: "_EventWrapper" has no attribute "type"  [attr-defined]
chatkit/agents.py:406: error: "_EventWrapper" has no attribute "item"  [attr-defined]
chatkit/agents.py:408: error: "_EventWrapper" has no attribute "item"  [attr-defined]
chatkit/agents.py:412: error: "_EventWrapper" has no attribute "item"  [attr-defined]
chatkit/agents.py:413: error: Incompatible types in "yield" (actual type "_EventWrapper", expected type "ThreadCreatedEvent | ThreadUpdatedEvent | ThreadItemDoneEvent | ThreadItemAddedEvent | ThreadItemUpdated | ThreadItemRemovedEvent | ThreadItemReplacedEvent | ProgressUpdateEvent | ErrorEvent | NoticeEvent")  [misc]
chatkit/agents.py:417: error: Incompatible types in assignment (expression has type "MessageOutputItem | HandoffCallItem | HandoffOutputItem | ToolCallItem | ToolCallOutputItem | ReasoningItem | MCPListToolsItem | MCPApprovalRequestItem | MCPApprovalResponseItem", variable has type "RawResponsesStreamEvent | RunItemStreamEvent | AgentUpdatedStreamEvent | _EventWrapper")  [assignment]
chatkit/agents.py:433: error: Incompatible types in assignment (expression has type "ResponseAudioDeltaEvent | ResponseAudioDoneEvent | ResponseAudioTranscriptDeltaEvent | ResponseAudioTranscriptDoneEvent | ResponseCodeInterpreterCallCodeDeltaEvent | <48 more items>", variable has type "RawResponsesStreamEvent | RunItemStreamEvent | AgentUpdatedStreamEvent | _EventWrapper")  [assignment]
chatkit/agents.py:433: note: Items in the first union not in the second: "ResponseAudioDeltaEvent", "ResponseAudioDoneEvent", "ResponseAudioTranscriptDeltaEvent", "ResponseAudioTranscriptDoneEvent", "ResponseCodeInterpreterCallCodeDeltaEvent", "ResponseCodeInterpreterCallCodeDoneEvent", "ResponseCodeInterpreterCallCompletedEvent", "ResponseCodeInterpreterCallInProgressEvent", "ResponseCodeInterpreterCallInterpretingEvent", "ResponseCompletedEvent", "ResponseContentPartAddedEvent", "ResponseContentPartDoneEvent", "ResponseCreatedEvent", "ResponseErrorEvent", "ResponseFileSearchCallCompletedEvent", "ResponseFileSearchCallInProgressEvent", "ResponseFileSearchCallSearchingEvent", "ResponseFunctionCallArgumentsDeltaEvent", "ResponseFunctionCallArgumentsDoneEvent", "ResponseInProgressEvent", "ResponseFailedEvent", "ResponseIncompleteEvent", "ResponseOutputItemAddedEvent", "ResponseOutputItemDoneEvent", "ResponseReasoningSummaryPartAddedEvent", "ResponseReasoningSummaryPartDoneEvent", "ResponseReasoningSummaryTextDeltaEvent", "ResponseReasoningSummaryTextDoneEvent", "ResponseReasoningTextDeltaEvent", "ResponseReasoningTextDoneEvent", "ResponseRefusalDeltaEvent", "ResponseRefusalDoneEvent", "ResponseTextDeltaEvent", "ResponseTextDoneEvent", "ResponseWebSearchCallCompletedEvent", "ResponseWebSearchCallInProgressEvent", "ResponseWebSearchCallSearchingEvent", "ResponseImageGenCallCompletedEvent", "ResponseImageGenCallGeneratingEvent", "ResponseImageGenCallInProgressEvent", "ResponseImageGenCallPartialImageEvent", "ResponseMcpCallArgumentsDeltaEvent", "ResponseMcpCallArgumentsDoneEvent", "ResponseMcpCallCompletedEvent", "ResponseMcpCallFailedEvent", "ResponseMcpCallInProgressEvent", "ResponseMcpListToolsCompletedEvent", "ResponseMcpListToolsFailedEvent", "ResponseMcpListToolsInProgressEvent", "ResponseOutputTextAnnotationAddedEvent", "ResponseQueuedEvent", "ResponseCustomToolCallInputDeltaEvent", "ResponseCustomToolCallInputDoneEvent"
chatkit/agents.py:624: error: Incompatible types in "yield" (actual type "Markdown | Text", expected type "TWidget")  [misc]
chatkit/agents.py:625: error: Incompatible types in "yield" (actual type "Markdown | Text", expected type "TWidget")  [misc]
chatkit/agents.py:722: error: Incompatible return value type (got "list[Message]", expected "EasyInputMessageParam | Message | ResponseOutputMessageParam | ResponseFileSearchToolCallParam | ResponseComputerToolCallParam | <16 more items> | list[EasyInputMessageParam | Message | ResponseOutputMessageParam | ResponseFileSearchToolCallParam | ResponseComputerToolCallParam | <16 more items>] | None")  [return-value]
Found 22 errors in 3 files (checked 10 source files)

after:

(openai-chatkit) ➜  chatkit-python git:(qb/mypy) mypy chatkit
Success: no issues found in 10 source files

@quettabit quettabit marked this pull request as ready for review October 7, 2025 08:52
@quettabit quettabit changed the title fix mypy errors fix: mypy chatkit errors Oct 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant