SQL Agent with open-source LLM #6050
Replies: 1 comment 3 replies
-
Hey @hamza-amin-4365! 👋 I'm here to help you out with any bugs, questions, or contributions you might have. I'm a bot designed to assist you while you wait for a human maintainer. Let's squash those bugs together! To resolve the issue of unexpected arguments being passed when creating an SQL agent using a Hugging Face LLM, ensure that the arguments passed to the import { HuggingFaceInference } from "@langchain/core/language_models/llms";
import { SqlToolkit, createSqlAgent } from "@langchain/agents/toolkits/sql";
import { SqlDatabase } from "@langchain/sql_db";
// Initialize the Hugging Face model
const model = new HuggingFaceInference({
model: "mistralai/Mixtral-8x7B-Instruct-v0.1",
temperature: 0.8,
maxTokens: 150,
apiKey: API_KEY,
});
// Initialize the SQL database and toolkit
const sqlDb = new SqlDatabase(/* your database config */);
const toolkit = new SqlToolkit(sqlDb, model);
// Create the SQL agent
const executor = createSqlAgent(model, toolkit, { topK: 5 });
// Invoke the agent
const result = await executor.invoke({
input: "List the total sales per country. Which country's customers spent the most?",
});
console.log(`Got output ${result.output}`); Ensure that when you call |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Checked other resources
Commit to Help
Example Code
Description
I'm trying to make an SQL agent with hugging face llm but it seems like the agent settings are only supposed to work with openai.
I've tried too many agents changing the whole toolkits and agent types still I get some errors regarding unexpected argument was passed. If anyone knows how to fix it please help.
Thanks
System Info
Windows 11
Beta Was this translation helpful? Give feedback.
All reactions