[BREAKING_CHANGES] refactor: change metadata type from map[string]string to map[string]any #944
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Describe the change
We use Litellm and Langfuse and I realized that the
map[string]string
data type in the metadata field is insufficient to pass some trace fields (e.g. tags, trace_metadata) from the metadata. It is possible to make metadata typemap[string]any
for more complex data types. There is no statement in the OpenAI document stating that metadata must be of typemap[string]string
Provide OpenAI documentation link
Litellm Langfuse Integration
OpenAI Metadata -> Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard.
Describe your solution
I changed the type of the metadata field in
ChatCompletionRequest
andModifyMessage
tomap[string]any
Tests
I ran the tests locally.
Issue: -