Conversation
…ec` for improved type safety and readability
Python SDK Unit Tests Results (Python 3.11)2 571 tests 2 571 ✅ 1m 0s ⏱️ Results for commit e909c92. ♻️ This comment has been updated with latest results. |
Python SDK Unit Tests Results (Python 3.12)2 571 tests 2 571 ✅ 1m 9s ⏱️ Results for commit e909c92. ♻️ This comment has been updated with latest results. |
Python SDK Unit Tests Results (Python 3.13)2 571 tests 2 571 ✅ 56s ⏱️ Results for commit e909c92. ♻️ This comment has been updated with latest results. |
Python SDK Unit Tests Results (Python 3.10)2 571 tests 2 571 ✅ 1m 11s ⏱️ Results for commit e909c92. ♻️ This comment has been updated with latest results. |
Python SDK Unit Tests Results (Python 3.14)2 571 tests 2 571 ✅ 44s ⏱️ Results for commit e909c92. ♻️ This comment has been updated with latest results. |
…es` for improved clarity and consistency within blueprint-related methods
…ve reusability and simplify type references across agent configuration classes
…roved modularity and maintainability across agent configuration code and tests
petrotiurin
left a comment
There was a problem hiding this comment.
Looks good, thanks for making this change!
Details
Source: Ollie session 4, issue #3
The high-level SDK method
update_blueprint(fields_with_values=...)tries to infer the backend type from the Python value. String values like "gpt-4o" causeTypeError: Unsupported type: gpt-4o— it's parsing the value as if it were a type. Even passing explicitfield_types={...: str}didn't fix it.Had to drop down to the raw REST API types (
AgentBlueprintWrite,AgentConfigValueWrite) to publish.Steps to reproduce:
Severity:
Major
Summary
Refactors
fields_with_valueshandling in the Python SDK's agent configuration module by introducing a dedicatedFieldValueSpecnamed tuple (in a newtypes.pymodule) to replace anonymous 3-tuples, improving type safety and readability acrossAgentConfigManagerandAgentConfig.Changes by Component
Python SDK
sdks/python/src/opik/api_objects/agent_config/types.pywith theFieldValueSpec(python_type, value, description)named tuple as the single canonical definition.config.pyto import and usetypes.FieldValueSpeceverywhere rawTuple[type, Any, Optional[str]]annotations existed; renamed localfields_with_valuesvariable toresolved_fields_with_valuesfor clarity._build_blueprint_payloadfrom an instance method onAgentConfigManagerinto a module-level function and updated it to useFieldValueSpecfield accessors instead of tuple unpacking.base.pyto import thetypesmodule and usetypes.FieldValueSpecin_extract_fields_with_valuesand_matches_blueprint, replacing raw tuple construction and destructuring.FieldValueSpecfrom theagent_configpackage__init__.py, importing it directly from.typesrather than re-exporting fromconfig.test_config.pyto usetypes.FieldValueSpec(...)instead of raw tuple literals.Files Changed
Change checklist
Issues
AI-WATERMARK
AI-WATERMARK: [yes|no]
Testing
Updated tests
Documentation
Added new explicit field value specification type with related documentation.