Skip to content

Add Support for File Attachments in Chat Completion Messages #1053

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

morecommits
Copy link

@morecommits morecommits commented Jul 22, 2025

https://platform.openai.com/docs/guides/pdf-files?api-mode=chat

Summary

This PR extends the chat completion API to support file attachments as message parts, via the ChatMessagePartTypeFile type.

Changes made:

  • Added a new struct, ChatMessageFile, with fields FileID, FileName, and FileData to represent file attachments. (chat.go, chat.goR84-R102)
  • Introduced a new constant, ChatMessagePartTypeFile, to represent the file type in ChatMessagePartType. (chat.go, chat.goR84-R102)
  • Updated the ChatMessagePart struct to include a File field of type *ChatMessageFile for handling file-related data. (chat.go, chat.goR84-R102)

Copy link

codecov bot commented Jul 22, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.59%. Comparing base (c4273cb) to head (abb8d55).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1053   +/-   ##
=======================================
  Coverage   99.59%   99.59%           
=======================================
  Files          34       34           
  Lines        2205     2205           
=======================================
  Hits         2196     2196           
  Misses          6        6           
  Partials        3        3           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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