-
Notifications
You must be signed in to change notification settings - Fork 45
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
[DRAFT] Quality assurance strategy for 3rd party API calls #224
Labels
draft-proposal
A draft proposal for how to manage this repository
Comments
oshoma
added
the
draft-proposal
A draft proposal for how to manage this repository
label
Nov 14, 2023
oshoma
changed the title
[PROPOSAL] Quality assurance strategy for 3rd party API calls
[DRAFT] Quality assurance strategy for 3rd party API calls
Nov 14, 2023
oshoma
added a commit
that referenced
this issue
Nov 16, 2023
Improve support for command line options - Use ArgumentParser to make parsing of command line options more robust - Add support for `gsite` option to scope search to a particular URL - Rename `real` tests to `external_api` to indicate tests that call 3rd party APIs (see #224 for more info) - Fix some broken tests There are 7 failing tests. This is a known issue and will be fixed separately, as the test breaks were introduced by other commits. Fixes #215
@20001LastOrder I added thoughts from our discussion today about making tests robust |
This was referenced Nov 17, 2023
Closed
To move this forward, I recently have the following thoughts:
|
I agree with all that. Test suite just uses mocks and runs completely
offline, no real interactions with 3rd party services, right?
Some other things we will still need:
1. A process to ensure the mocks remain consistent over time with the
output of the services we're mocking. Because API signatures change and
LLM output varies over time.
2. Automated smoke tests and/or acceptance tests to prove the system is
working properly with 3rd party services whenever we deploy it to
production.
3. Logic to gracefully handle failing calls to 3rd party services. Because
sometimes they'll be down, overloaded, API key blocked, etc.
…On Fri, Feb 9, 2024 at 11:11 AM Boqi (Percy) Chen ***@***.***> wrote:
To move this forward, I recently have the following thoughts:
1. The content of external API calls is not really important when
testing offline, unless, of course, the test is about features using that
API call directly. Since the ultimate content is generated by the LLM,
which is already handled with caching right now.
2. Based on the above observation, I think
- If the API call is part of integration testing (e.g. QA agent
using Google Search), we can just *mock* it with anything that
follows the same format as the response of the API
- If the API call is the essential part of the integration testing,
we should mock it with meaningful content following the format of the API.
(For example, testing of number validation with Google Search should be
mocked with some sample Google Search results containing numbers).
—
Reply to this email directly, view it on GitHub
<#224 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAKWT56SJJUUUO2MJUPNJLYSZDD5AVCNFSM6AAAAAA7LJPXY6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMZWGIYDCNJYG4>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
PROBLEM
Some of our tests call 3rd party APIs such as Serper (Google Search). This can give us non-deterministic results, slow tests, and tests that cost real money. It could also result in pushback from service providers due to bursty API call volumes. See background discussion.
SOLUTION
We need to define how we will test the quality of code that depends on 3rd party APIs via libraries. Here's a draft proposal for comment:
Goals
make test
will operate offline. Tests will not perform network calls, including function calls to 3rd party APIs. Furthermore, the tests will be crafted to be deterministic. This avoids the problems described above, and is a necessary stepping stone towards implementing automatic testing on developer desktops and in Github actions.make test
will perform calls to 3rd party APIs. The purpose of this mode is to run end-to-end integration tests to demonstrate that our system is working in the real world. Since these tests are expected to be relatively slow, and will cost real money, they should only be run occasionally, e.g. when we are preparing to deploy into production.Developer Guidelines
@pytest.mark.external-api-call
. Modify pyproject.toml so these tests do not run by default. Instead they can be selectively run by passing in a flag to pytest, e.g. `pytest -v -m external-api-call'Implementation Thoughts
Here are additional thoughts from 2023-11-16 discussion with @20001LastOrder about how we might implement this:
a) send to normal console output
b) send to fixure files, to be used for tests
...based on a command line option
The text was updated successfully, but these errors were encountered: