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

quote should be nullable in MessageContentTextAnnotationsFileCitationObject #263

Closed
davidmigloz opened this issue May 20, 2024 · 7 comments

Comments

@davidmigloz
Copy link
Contributor

The quote property is marked as required, but the server doesn't include them in all the cases.

openai-openapi/openapi.yaml

Lines 11362 to 11397 in 893ba52

MessageContentTextAnnotationsFileCitationObject:
title: File citation
type: object
description: A citation within the message that points to a specific quote from a specific File associated with the assistant or the message. Generated when the assistant uses the "file_search" tool to search files.
properties:
type:
description: Always `file_citation`.
type: string
enum: ["file_citation"]
text:
description: The text in the message content that needs to be replaced.
type: string
file_citation:
type: object
properties:
file_id:
description: The ID of the specific File the citation is from.
type: string
quote:
description: The specific quote in the file.
type: string
required:
- file_id
- quote
start_index:
type: integer
minimum: 0
end_index:
type: integer
minimum: 0
required:
- type
- text
- file_citation
- start_index
- end_index

Example of response that doesn't include it:

{
  "id": "msg_Fn6zTxxx",
  "object": "thread.message",
  "created_at": 1715820384,
  "assistant_id": "asst_K4iArkxxx",
  "thread_id": "thread_3N31Erp0eCVhAhKh5BdMk1aQ",
  "run_id": "run_icH57L9xxx",
  "status": "completed",
  "incomplete_details": null,
  "incomplete_at": null,
  "completed_at": 1715820391,
  "role": "assistant",
  "content": [
    {
      "type": "text",
      "text": {
        "value": "...",
        "annotations": [
          {
            "type": "file_citation",
            "text": "【6:0†source】",
            "start_index": 1109,
            "end_index": 1121,
            "file_citation": {
              "file_id": "file-TrXXpxxx"
            }
          }
        ]
      }
    }
  ],
  "attachments": [],
  "metadata": {}
}
@dahifi
Copy link

dahifi commented Jun 11, 2024

Jumping in here. We did a fair amount of work in v1 to get this rendering well, and it seems like the quote is no longer returned for any of the v2 endpoints. Some of the older models might still do it, but not the new ones.

There are a couple threads on the community server, including this one with response from OAI staff member that it's not supported but "we'll work on" it.

Not sure where else to track it, but this OpenAPI repo seems more appropriate than the python API one.

But yes, I can also imagine that this causes _strict_response_validation to fail on every call.

@nknj
Copy link
Member

nknj commented Jun 12, 2024

Apologies for the oversight here -- we just rolled out a fix to remove quote from the openapi spec and will roll out updated sdks shortly.

@nknj nknj closed this as completed Jun 12, 2024
@dahifi
Copy link

dahifi commented Jun 13, 2024

Apologies for the oversight here -- we just rolled out a fix to remove quote from the openapi spec and will roll out updated sdks shortly.

Not sure if this is the place to discuss this further, but having the quote available at the client level is going to be crucial for RAG validation. Removing it is a bad move.

@Adham-Mamedov
Copy link

@nknj Is team going to add quotes back?
It was really helpful in v1. I am working with legal documents, so having direct quotes would decrease the chance of assistant misinterpretation and errors.

@DennisPeeters
Copy link

Indeed, same issue

@sheldonrampton
Copy link

The 'quote' attribute is referenced in the OpenAI documentation:

https://platform.openai.com/docs/assistants/deep-dive/managing-threads-and-messages

If it has been removed, the documentation needs to be updated.

@eirikora
Copy link

In current version, I seem to be experiencing the same issue. See:
openai/openai-python#1498 (comment)

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

No branches or pull requests

7 participants