-
Notifications
You must be signed in to change notification settings - Fork 20.4k
chore(langchain): activate mypy warn-unreachable #34553
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
| # type narrowing not working appropriately w/ callable check, can fix later | ||
| return True, handle_errors(exception) # type: ignore[return-value,call-arg] | ||
| return False, "" | ||
| return True, handle_errors(exception) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
type narrowing now works because handle_errors cannot be a type anymore at this stage.
Note that type is callable.
| if not _HAS_RESOURCE: # pragma: no cover - defensive | ||
| return | ||
| pid = process.pid | ||
| if pid is None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
subprocess.Popen.pid is never None.
Is it OK ?
| system_prompt: str | SystemMessage | None = None, | ||
| middleware: Sequence[AgentMiddleware[StateT_co, ContextT]] = (), | ||
| response_format: ResponseFormat[ResponseT] | type[ResponseT] | None = None, | ||
| response_format: ResponseFormat[ResponseT] | type[ResponseT] | dict[str, Any] | None = None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to test_json_schema, create_agent's response_format can be a dict.
Which means it has to be supported in AutoStrategy/ToolStrategy/ProviderStrategy/_SchemaSpec
| content = message.content | ||
| if isinstance(content, str): | ||
| return content | ||
| if isinstance(content, list): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BaseMessage.content is either a str or a list.
So there should be no need to have a fallback.
d559b93 to
67ee999
Compare
No description provided.