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

🔧 fix: API Key Handling for GoogleSearch and TavilySearch Tools #3541

Merged

Conversation

jung0han
Copy link
Contributor

@jung0han jung0han commented Aug 5, 2024

Summary

This pull request addresses several issues and improvements related to handling API keys for GoogleSearch and TavilySearch tools.

  • Fixed the way user-provided API keys are handled, ensuring they’re fetched correctly.
  • Improved error handling to give clear feedback when environment variables are missing.
  • Added new test cases to make sure everything works as expected.

Change Type

  • Bug fix (non-breaking change which fixes an issue)

Testing

To test these changes:

  1. Run the unit tests for the GoogleSearch and TavilySearch:
npm run test api/app/clients/tools/structured/specs/GoogleSearch.spec.js
npm run test api/app/clients/tools/structured/specs/TavilySearchResults.spec.js
  1. Manually test the GoogleSearch and TavilySearch functionality in the application, ensuring that:
  • Ensure TAVILY_API_KEY, GOOGLE_SEARCH_API_KEY, and GOOGLE_CSE_ID are not set in the .env file.
  • In Assistant Tools, add GoogleSearch and TavilySearch plugins, providing the required API key fields.
  • Write and execute a prompt using these tools.
  • Verify that an error occurs due to the API keys not being retrieved correctly.

Checklist

  • My code adheres to this project's style guidelines
  • I have performed a self-review of my own code
  • I have commented in any complex areas of my code
  • My changes do not introduce new warnings
  • I have written tests demonstrating that my changes are effective or that my feature works
  • Local unit tests pass with my changes

@danny-avila danny-avila changed the title fix: API Key Handling for GoogleSearch and TavilySearch Tools 🔧 fix: API Key Handling for GoogleSearch and TavilySearch Tools Aug 5, 2024
@danny-avila
Copy link
Owner

Thanks! lgtm

@danny-avila danny-avila merged commit 6879de0 into danny-avila:main Aug 5, 2024
1 check passed
danny-avila pushed a commit that referenced this pull request Aug 17, 2024
* fix: get user-provided API key using environment variable names as keys

* feat: Add error handling for missing API key and search engine ID

* feat: Add GoogleSearch and TavilySearchResults specs for environment variables handling

---------

Co-authored-by: Dongwoo Jeong <dongwoo.jeong@lge.com>
kenshinsamue pushed a commit to intelequia/LibreChat that referenced this pull request Sep 17, 2024
…y-avila#3541)

* fix: get user-provided API key using environment variable names as keys

* feat: Add error handling for missing API key and search engine ID

* feat: Add GoogleSearch and TavilySearchResults specs for environment variables handling

---------

Co-authored-by: Dongwoo Jeong <dongwoo.jeong@lge.com>
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

Successfully merging this pull request may close these issues.

2 participants