-
Notifications
You must be signed in to change notification settings - Fork 0
fix: make otel util genai compatible with 3.9 #26
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: genai-utils-e2e-dev
Are you sure you want to change the base?
fix: make otel util genai compatible with 3.9 #26
Conversation
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.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
| categories: Sequence[str], | ||
| method_name: str, | ||
| *, | ||
| obj: Any | None = None, | ||
| error: Error | None = None, | ||
| obj: Union[Any, None] = None, | ||
| error: Union[Error, None] = None, | ||
| results: Sequence[EvaluationResult] | 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.
Replace remaining union operators for Python 3.9 compatibility
The CompositeEmitter changes switch some annotations to typing.Union, but _dispatch still declares results: Sequence[EvaluationResult] | None. Python 3.9 cannot parse the | type-union syntax, so importing this module on 3.9 will still raise a SyntaxError. For the stated goal of 3.9 support, the remaining | usages in this file (e.g. Sequence[str] | None in the constructor and iterator helpers) also need to be converted to Union[...] or Optional[...].
Useful? React with 👍 / 👎.
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.
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.
To use Codex here, create a Codex account and connect to github.
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.
@codex How were you integrated on this and what can be done to get more helpful reviews from you?
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.
To use Codex here, create a Codex account and connect to github.
| self, | ||
| metrics: Iterable[str] | None = None, | ||
| *, | ||
| invocation_type: str | None = None, | ||
| invocation_type: Union[str, None] = None, | ||
| options: Mapping[str, str] | 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.
Evaluator constructor still uses PEP 604 unions
Although Union is now imported, the Evaluator initializer keeps metrics: Iterable[str] | None and options: Mapping[str, str] | None. These annotations still rely on the Python 3.10 union operator and will fail to parse on Python 3.9, so the module remains incompatible with the version this change targets. Converting these to Union[Iterable[str], None] (or Optional) is required for true 3.9 support.
Useful? React with 👍 / 👎.
| target: EvaluatorFactory, | ||
| *, | ||
| metrics: Sequence[str] | None = None, | ||
| invocation_type: str | None = None, | ||
| invocation_type: Union[str, None] = None, | ||
| options: Mapping[str, str] | 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.
Registry helpers still contain Python 3.10-only union syntax
The registry’s _call_with_optional_params function continues to annotate parameters with metrics: Sequence[str] | None and options: Mapping[str, str] | None. These annotations use the | union operator that is unavailable in Python 3.9, so importing this module will still raise a syntax error even after this patch. To make the genai util package 3.9 compatible, these remaining unions need to be rewritten using typing.Union/Optional as done elsewhere.
Useful? React with 👍 / 👎.
|
@codex review |
|
Codex Review: Didn't find any major issues. What shall we delve into next? ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. |
a8d3a8c to
90e5276
Compare
0da85b4 to
022f242
Compare
Use Union
022f242 to
35edb49
Compare
Description
Fixes # (issue)
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Does This PR Require a Core Repo Change?
Checklist:
See contributing.md for styleguide, changelog guidelines, and more.