Skip to content

🔨 fix(ToolCall): Check output string type before performing .toLowerCase()#4324

Merged
danny-avila merged 1 commit into
danny-avila:mainfrom
hanna-daoud:fix/issue-4303-Experimental-Agents-broken-with-custom-endpoints
Oct 8, 2024
Merged

🔨 fix(ToolCall): Check output string type before performing .toLowerCase()#4324
danny-avila merged 1 commit into
danny-avila:mainfrom
hanna-daoud:fix/issue-4303-Experimental-Agents-broken-with-custom-endpoints

Conversation

@hanna-daoud

Copy link
Copy Markdown
Contributor

Pull Request Template

⚠️ Before Submitting a PR, Please Review:

  • Please ensure that you have thoroughly read and understood the Contributing Docs before submitting your Pull Request.

⚠️ Documentation Updates Notice:

  • Kindly note that documentation updates are managed in this repository: librechat.ai

Summary

Fixes issue #4303: This PR adds a type check for output before calling .toLowerCase() to ensure it is a string. This prevents potential runtime errors when output is undefined or not a string.

Change Type

Please delete any irrelevant options.

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

Testing

Create an assistant action, and let the assistant call it. It used to throw errors and break the UI, now it works perfectly.

Test Configuration:

Checklist

Please delete any irrelevant options.

  • My code adheres to this project's style guidelines
  • I have performed a self-review of my own code
  • My changes do not introduce new warnings

@danny-avila

danny-avila commented Oct 4, 2024

Copy link
Copy Markdown
Owner

Are you sure that your custom endpoint is even being used? looking at the code, it should actually fail, and maybe another configured endpoint is being used

Or is this fix exclusively for use with Assistants, not Agents?

@hanna-daoud

hanna-daoud commented Oct 4, 2024

Copy link
Copy Markdown
Contributor Author

This fix is only tested on Assistants and not agents. Also, I created a fresh assistant and added only 1 endpoint for the sake of test. My endpoint is a local one so I added logging to make sure it is being accessed and yes, it is being accessed and the function is running to the end.

@danny-avila danny-avila changed the title Fix issue #4303: Check output type if it is a string before performing .toLowerCase() 🔨 fix(ToolCall): Check output type if it is a string before performing .toLowerCase() Oct 7, 2024
@danny-avila danny-avila changed the title 🔨 fix(ToolCall): Check output type if it is a string before performing .toLowerCase() 🔨 fix(ToolCall): Check output string type before performing .toLowerCase() Oct 7, 2024
@danny-avila

Copy link
Copy Markdown
Owner

This fix is only tested on Assistants and not agents. Also, I created a fresh assistant and added only 1 endpoint for the sake of test. My endpoint is a local one so I added logging to make sure it is being accessed and yes, it is being accessed and the function is running to the end.

Thanks for letting me know and for your contribution!

@danny-avila danny-avila merged commit bdc2fd3 into danny-avila:main Oct 8, 2024
owengo pushed a commit to openwengo/LibreChat that referenced this pull request Oct 14, 2024
BertKiv pushed a commit to BertKiv/LibreChat that referenced this pull request Dec 10, 2024
MichielMAnalytics pushed a commit to MichielMAnalytics/ProAI that referenced this pull request Jun 6, 2025
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