-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Add OpenAI tests #4846
Add OpenAI tests #4846
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, thanks a lot that’s really some awesome tests
bors merge
let compressed_responses = include_bytes!("openai_tokenized_responses.json.gz"); | ||
let mut responses = Vec::new(); | ||
let mut decoder = flate2::write::GzDecoder::new(&mut responses); | ||
|
||
decoder.write_all(compressed_responses).unwrap(); | ||
drop(decoder); | ||
serde_json::from_slice(&responses).unwrap() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We may consider putting an on-disk cache on this part if it starts taking a lot of time
// test with a server that responds 500 on 3 out of 4 calls | ||
#[actix_rt::test] | ||
async fn it_still_works() { | ||
let (_mock, setting) = create_fallible_mock().await; | ||
let server = get_server_vector().await; | ||
let index = server.index("doggo"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a very nice test tbh
It’s awesome you did it
4846: Add OpenAI tests r=irevoire a=dureuill # Pull Request ## Related issue Part of fixing #4757 ## What does this PR do? - OpenAI embedder: don't pass apiKey when it is empty (slightly improves error messages) - rest embedder and rest-based embedders: specialize the authorization denied error message depending on the configuration source - fix existing tests - Adds assets containing prerecorded texts to embed and the embeddings obtained from OpenAI - Adds an asset containing a tokenized long document and the embedding obtained from OpenAI for this token - Uses the wiremock crate to mock the OpenAI API: parse the openai request, lookup the response in assets, craft an openai response Co-authored-by: Louis Dureuil <[email protected]>
Build failed: |
bors merge |
Build succeeded:
|
Pull Request
Related issue
Part of fixing #4757
What does this PR do?