Skip to content

Conversation

dwohlfahrt
Copy link

  • Introduced a SequenceNumber class to manage and increment sequence numbers for streaming events.
  • Updated various event responses in the openai_endpoint to include the sequence number, ensuring compliance with the OpenAI pipeline.
  • Enhanced event data consistency by incorporating sequence numbers in response events such as response.created, response.in_progress, and others.

- Introduced a SequenceNumber class to manage and increment sequence numbers for streaming events.
- Updated various event responses in the openai_endpoint to include the sequence number, ensuring compliance with the OpenAI pipeline.
- Enhanced event data consistency by incorporating sequence numbers in response events such as response.created, response.in_progress, and others.
"input_tokens": usage_stats["input_tokens"],
"output_tokens": usage_stats["output_tokens"],
"total_tokens": usage_stats["input_tokens"]
"usage": OpenAIUsage(
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fixes this Pydantic warning:

/Users/dwohlfahrt/workspace/github/dwohlfahrt/mlx-testbed/.venv/lib/python3.13/site-packages/pydantic/main.py:519: UserWarning: Pydantic serializer warnings:
  PydanticSerializationUnexpectedValue(Expected `OpenAIUsage` - serialized value may not be as expected [input_value={'input_tokens': 33, 'out... 13, 'total_tokens': 46}, input_type=dict])
  return self.__pydantic_serializer__.to_json(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant