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

feat(api): openai compliant annotations with additional metadata #870

Closed
wants to merge 79 commits into from

Conversation

gphorvath
Copy link

@gphorvath gphorvath commented Aug 2, 2024

  • Adds vector_content ids to metadata returned by runs endpoints
  • Adds an endpoint for querying vector_content to leapfrogai namespace - which contains chunk text

@gphorvath gphorvath linked an issue Aug 2, 2024 that may be closed by this pull request
@gphorvath gphorvath self-assigned this Aug 2, 2024
@gphorvath gphorvath added the enhancement New feature or request label Aug 2, 2024
Copy link

netlify bot commented Aug 2, 2024

Deploy Preview for leapfrogai-docs canceled.

Name Link
🔨 Latest commit bacbd58
🔍 Latest deploy log https://app.netlify.com/sites/leapfrogai-docs/deploys/66f6d6f93af5680008d5990f

@alekst23
Copy link
Contributor

alekst23 commented Aug 7, 2024

The annotations were not quite working with a simplistic test file that just said "Testing", so I had to augment it a little with some text data, and added a correlated question to the test file.

Perhaps there's better data we can use for this purpose.

@alekst23
Copy link
Contributor

alekst23 commented Aug 8, 2024

I created a conformance test method that will evaluate the same feature in a separate call to OpenAI and LeapfrogAI:
test_conf_chat_files.py > test_file_annotations

This method tries to evaluate Annotations returned from an Assistant query, but will inherently also evaluate the features that build the Assistant in the process:

  • Create VectorStore
  • Create Thread
  • Create and Poll Runs
  • Create Assistant

We should set these up as separate tests on their own to isolate errors.

Presently, the OpenAI call succeeds and returns the proper type structure.

LeapfrogAI call fails with a number of issues related to the structure of the message object in the parameter:

  • id, missing
  • content, must be list
  • created_at, missing
  • object, missing
  • status, missing
  • thread_id, missing

This fails on call to client.beta.threads.create with response:

"POST /openai/v1/threads HTTP/1.1" 422 Unprocessable Entity 

@alekst23
Copy link
Contributor

I have moved conformance testing for individual components to another PR and removed the code from here.

What's left should be a more minimal test focusing on conformance of file annotations.

Some issues that were identified via testing:

  • threads.runs.create_and_poll - This should only attach messages to the run that were generated by the run itself, not any previous messages.
  • OpenAI annotations format is very simplistic and looks like this: 【4:0†source】
  • LeapfrogAI annotations format is this: [file-uuid]

This is an issue with runs not file annotations
@alekst23
Copy link
Contributor

TODO:
Reformat annotations:
src/leapfrogai_api/backend/converters.py:57

@gphorvath gphorvath changed the title feat(api): better annotations feat(api): openai compliant annotations Sep 3, 2024
@gphorvath
Copy link
Author

Closing in favor of:

#1165
#1164

@gphorvath gphorvath closed this Sep 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat(api): return more annotation details
6 participants