Skip to content
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

feat: introduce class method to create ChatMessage from the OpenAI dictionary format #8670

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

anakin87
Copy link
Member

@anakin87 anakin87 commented Dec 20, 2024

Related Issues

Proposed Changes:

  • introduce ChatMessage.from_openai_dict_format class method: It allows you to create a ChatMessage
    from a dictionary in the format expected by OpenAI's Chat API.

How did you test it?

CI, new tests

Checklist

  • I have read the contributors guidelines and the code of conduct
  • I have updated the related issue with new insights and changes
  • I added unit tests and updated the docstrings
  • I've used one of the conventional commit types for my PR title: fix:, feat:, build:, chore:, ci:, docs:, style:, refactor:, perf:, test: and added ! in case the PR includes breaking changes.
  • I documented my code
  • I ran pre-commit hooks and fixed any issue

@github-actions github-actions bot added topic:tests type:documentation Improvements on the docs labels Dec 20, 2024
@anakin87 anakin87 changed the title feat: introduce class method to creat ChatMessage from the OpenAI dictionary format feat: introduce class method to create ChatMessage from the OpenAI dictionary format Dec 20, 2024
@coveralls
Copy link
Collaborator

coveralls commented Dec 20, 2024

Pull Request Test Coverage Report for Build 12436465454

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 4 unchanged lines in 2 files lost coverage.
  • Overall coverage increased (+0.03%) to 90.982%

Files with Coverage Reduction New Missed Lines %
components/generators/chat/openai.py 2 96.24%
dataclasses/chat_message.py 2 99.06%
Totals Coverage Status
Change from base Build 12433239243: 0.03%
Covered Lines: 8535
Relevant Lines: 9381

💛 - Coveralls

Comment on lines -311 to -314
print("callback")
print(callback)
print("-" * 100)

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm also removing these ugly print I put in #8666 😅

@anakin87 anakin87 marked this pull request as ready for review December 20, 2024 18:21
@anakin87 anakin87 requested review from a team as code owners December 20, 2024 18:21
@anakin87 anakin87 requested review from dfokina and mpangrazzi and removed request for a team December 20, 2024 18:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic:tests type:documentation Improvements on the docs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ChatMessage: expose from_openai_dict and to_openai_dict utility functions
2 participants