Agents and chains? #607
-
Hey this is a great project initiative. I'm struggling to understand does this project supports agents and chains For example can I accomplish this: from dotenv import load_dotenv
from langchain_community.utilities import SQLDatabase
from langchain_openai import ChatOpenAI
from langchain_community.agent_toolkits import create_sql_agent
load_dotenv()
if __name__ == "__main__":
llm = ChatOpenAI(model="gpt-3.5-turbo", temperature=0)
db = SQLDatabase.from_uri("sqlite:///Chinook.db")
agent_executor = create_sql_agent(llm, db=db, agent_type="openai-tools", verbose=True)
while True:
question = input("Ask a question (or type 'exit' to quit): ")
if question.lower() == "exit":
break
try:
response = agent_executor.invoke({"input": question })
print(response)
except Exception as e:
print(e)
continue Thank you ✌️ |
Beta Was this translation helpful? Give feedback.
Answered by
mattlindsey
May 5, 2024
Replies: 1 comment 1 reply
-
Hi @dixpac. There's an explanation of the langchainrb |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
dixpac
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @dixpac. There's an explanation of the langchainrb
Langchain::Assistant
class in the README and an exampleexamples\assistant_chat.rb
just like your Python example above. Just use theLangchain::Tool::Database
tool instead of the weather tool.It works with OpenAI now. GoogleGemini and others soon I think.
Any feedback would be great!