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

Not support doc format #1813

Open
1 task
Panweitong opened this issue Oct 23, 2024 · 5 comments
Open
1 task

Not support doc format #1813

Panweitong opened this issue Oct 23, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@Panweitong
Copy link

Panweitong commented Oct 23, 2024

Confirm this is an issue with the Python library and not an underlying OpenAI API

  • This is an issue with the Python library

Describe the bug

OpenAI Docs:
1729676939016

Python library:
1729677950967

To Reproduce

Use Files API to Upload doc file,and use "assistants" for Assistants

Code snippets

import openai,io
import requests

openai.api_key = "xxxxxxxxxxxxxxxxxxx"

class FileLike(io.BytesIO):
  def __init__(self, _bytes, filename=None):
    super().__init__(_bytes)
    self.name = filename

url = "https://ccrb.s3.cn-northwest-1.amazonaws.com.cn/%E7%BB%B3%E8%88%9E%E9%A3%9E%E6%89%AC%E6%B4%BB%E5%8A%9B%E7%BB%BD%E6%94%BE.doc"

r = requests.get(url)
fileName = url.split("https://ccrb.s3.cn-northwest-1.amazonaws.com.cn/")[1]

bytes_io = io.BytesIO(r.content)
file_bytes = bytes_io.read()

res = openai.files.create(
  file=FileLike(file_bytes, fileName), purpose="assistants"
)
if res.id and res.status == "processed":
  file = openai.files.retrieve(res.id)
  print(file)

OS

Ubuntu

Python version

Python v3.10.12

Library version

openai v1.51.0

@Panweitong Panweitong added the bug Something isn't working label Oct 23, 2024
@RobertCraigie
Copy link
Collaborator

Thanks for the report, can you share an example snippet to reproduce the issue?

@Panweitong
Copy link
Author

Thanks for the report, can you share an example snippet to reproduce the issue?

OK,I will share an example snippet later.

@Panweitong
Copy link
Author

Panweitong commented Oct 23, 2024

Thanks for the report, can you share an example snippet to reproduce the issue?

import openai,io
import requests

openai.api_key = "xxxxxxxxxxxxxxxxxxx"

class FileLike(io.BytesIO):
  def __init__(self, _bytes, filename=None):
    super().__init__(_bytes)
    self.name = filename

url = "https://ccrb.s3.cn-northwest-1.amazonaws.com.cn/%E7%BB%B3%E8%88%9E%E9%A3%9E%E6%89%AC%E6%B4%BB%E5%8A%9B%E7%BB%BD%E6%94%BE.doc"

r = requests.get(url)
fileName = url.split("https://ccrb.s3.cn-northwest-1.amazonaws.com.cn/")[1]

bytes_io = io.BytesIO(r.content)
file_bytes = bytes_io.read()

res = openai.files.create(
  file=FileLike(file_bytes, fileName), purpose="assistants"
)
if res.id and res.status == "processed":
  file = openai.files.retrieve(res.id)
  print(file)

@Panweitong
Copy link
Author

Panweitong commented Oct 23, 2024

Thanks for the report, can you share an example snippet to reproduce the issue?

1729683274389

ef7cc2e7cbbaa0cf641c592f764d672

I tried to test it with the API, but it still reported an error, but the documentation says it supports doc format

@ganeshhnalla
Copy link

@Panweitong OpenAI accepts files of various formats (e.g., .txt, .csv, .json, .pdf, .docx, .doc, etc.), but it's always good to ensure that the version of the API you're using indeed supports doc files.

If you're attempting to use doc files, ensure the content is properly extracted, as doc is a binary format, and OpenAI may have trouble directly interpreting the binary content.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants