我看到这里有多种图像生成方法: https://platform.openai.com/docs/api-reference/images
但我只是想向聊天 gpt 发送一个 png 文件,问“这是什么?” 或类似的事情,然后得到回复。
ChatGPT 是在类似 Jupyter 的环境中运行 Python 的最新平台。然而,安装的库是有限的。您也无法访问互联网。所以,我无法使用 pip 来安装。
如何安装新库?
ChatGPT 的网络界面可以轻松上传 pdf 文件。openAI 有没有可以接收 pdf 的 API?
我知道有 3rd 方库可以读取 pdf,但考虑到 pdf 中有图像和其他重要信息,如果像 GPT 4 Turbo 这样的模型提供实际的 pdf 可能会更好。
我将陈述我的用例以添加更多上下文。我打算做RAG。这是我的pdf,这是提示。通常我会在提示末尾附加文本。如果我自己提取pdf文件,我仍然可以做到这一点。
这就是我应该做的吗?代码来自此处https://platform.openai.com/docs/assistants/tools/code-interpreter
# Upload a file with an "assistants" purpose
file = client.files.create(
file=open("example.pdf", "rb"),
purpose='assistants'
)
# Create an assistant using the file ID
assistant = client.beta.assistants.create(
instructions="You are a personal math tutor. When asked a math question, write and run code to answer the question.",
model="gpt-4-1106-preview",
tools=[{"type": "code_interpreter"}],
file_ids=[file.id]
)
Run Code Online (Sandbox Code Playgroud)
还有一个上传端点,但这些端点的目的似乎是用于微调和助手。我认为 RAG 用例是一个正常的用例,与助手没有必然关系。