edubruell / tidyllm

An tidy interface to large language model APIs for R
https://edubruell.github.io/tidyllm/
Other
36 stars 2 forks source link

Implement mocking-based tests for all API functions #15

Closed edubruell closed 1 month ago

edubruell commented 1 month ago

Description: Create a set of mocking-based tests for all API functions to ensure that tests do not rely on real API calls. This will improve the robustness of the test suite, ensuring tests are fast, reliable, and isolated from external dependencies like API rate limits or changes.

Possible Actions:

Additional Considerations:

edubruell commented 1 month ago

Tests for claude() added using httptest2. Also perform_api_request() got new .dry_run functionality that can be used in the api-functions to create dry runs of POST requests. This will be added to the other API functions before the next version increment.

Note: The mocking functionality might also be really useful for vignettes! I will add this to my vignettes, once I write better documentation.

edubruell commented 1 month ago

Added missing tests in version 0.1.6. There is still potential to extend the testing strategy to further functions like ollama_list_models() or extend edge cases in the exsisting API functions.