Metadata should have a nicely typed `put` method
Nobody has claimed this yet.
- Dominant language
- Kotlin
- Stars
- 1.5k
- Forks
- 264
- Avg merge
- 9h 46m
- Merged PRs (30d)
- 96
Description
metadata setter of ResponseCreateParams.builder()accepts Metadata object, which, in turn may contain ```
numeric fields:
val metadata = Metadata.builder()
.putAdditionalProperty("someNumericId", JsonNumber.of(123))
.build();
Response with such metadata instance fails though:
ResponseCreateParams.builder().metadata(metadata).build()....
showing error:
com.openai.errors.BadRequestException: 400: OpenAIError{additionalProperties={error={message=Invalid type for 'metadata.someNumericId': expected a string, but got an integer instead., type=invalid_request_error, param=metadata.someNumericId, code=invalid_type}}}
String as a value works fine though.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the Metadata.builder() and ResponseCreateParams.builder().metadata(metadata) entry points shown in the report, then trace how additional metadata values are serialized. Confirm the expected metadata value types and reproduce the numeric-value failure; done means numeric metadata is accepted consistently with the API's documented behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- kotlin
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100