Description
There is a namespace collision between the Agent class/module defined in my application and the Agent module in LangChain.rb. When LangChain.rb is loaded, it overrides my application's Agent class, causing a TypeError. I suspect other modules (as for example Tool) could lead to the same problem.
To Reproduce
Steps to reproduce the behavior:
Define an Agent class or module in the application.
Install and load the LangChain gem in the application.
Launch the application
LangChain's Agent module conflicts with the application's Agent class, raising an error.
Expected behavior
I expect LangChain's Agent module to be scoped under the Langchain namespace (e.g., Langchain::Agent) to avoid any conflicts with an Agent class or module in the global namespace.
Terminal commands & output
Here is the terminal output showing the conflict:
app_1 | /app1-app/app/models/agent.rb:7:in `<main>': Agent is not a class (TypeError)
app_1 | /usr/local/bundle/gems/langchainrb-0.3.14/lib/langchain.rb:34: previous definition of Agent was here
Desktop (please complete the following information):
OS: Debian 11
Ruby version: 2.7.6
LangChain.rb version: 0.3.14
Additional context
The issue could be solved by namespacing the Agent module inside the Langchain module (e.g., Langchain::Agent) to avoid polluting the global namespace.
As certain names (e.g. Agent, Tool) are quite common it could be useful to namespace them inside langchainrb.
Description
There is a namespace collision between the
Agent
class/module defined in my application and theAgent
module in LangChain.rb. When LangChain.rb is loaded, it overrides my application'sAgent
class, causing aTypeError
. I suspect other modules (as for example Tool) could lead to the same problem.To Reproduce
Steps to reproduce the behavior:
Agent
class or module in the application.Agent
module conflicts with the application'sAgent
class, raising an error.Expected behavior
I expect LangChain's
Agent
module to be scoped under theLangchain
namespace (e.g.,Langchain::Agent
) to avoid any conflicts with anAgent
class or module in the global namespace.Terminal commands & output
Here is the terminal output showing the conflict:
Desktop (please complete the following information):
Additional context
The issue could be solved by namespacing the
Agent
module inside theLangchain
module (e.g.,Langchain::Agent
) to avoid polluting the global namespace.As certain names (e.g. Agent, Tool) are quite common it could be useful to namespace them inside langchainrb.