patterns-ai-core / langchainrb

Build LLM-powered applications in Ruby
https://rubydoc.info/gems/langchainrb
MIT License
1.3k stars 181 forks source link

Update loader.rb #676

Closed michelson closed 3 months ago

michelson commented 3 months ago

The URI::DEFAULT_PARSER.escape method escapes a string so that it is safe to use as a URL, but it doesn't handle URLs that are already percent-encoded or have special characters.

This PR makes it possible to unescape the URL and then use URI::DEFAULT_PARSER.escape. However, it's generally better to handle URLs using a library designed for such tasks, like Addressable::URI.