Skip to content

Not support doc format #1813

Closed as not planned
Closed as not planned
@Panweitong

Description

@Panweitong

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions