Open mamaart opened 9 months ago
I made a little project with ollama and sqlite
when I call the chain the generated sqlstring is wrapped in backtics and the call fails with a syntax error
❯ go run . panic: near "'''sql SELECT username, COUNT(*) AS logins FROM users GROUP BY username ORDER BY logins DESC LIMIT 1; "''': syntax error
package main import ( "context" "fmt" "github.com/tmc/langchaingo/chains" "github.com/tmc/langchaingo/llms/ollama" "github.com/tmc/langchaingo/tools/sqldatabase" "github.com/tmc/langchaingo/tools/sqldatabase/sqlite3" ) func run() error { llm, err := ollama.New(ollama.WithModel("mistral")) if err != nil { return err } engine, err := sqlite3.NewSQLite3("./db.sql") if err != nil { return err } db, err := sqldatabase.NewSQLDatabase(engine, nil) if err != nil { return err } defer db.Close() sqlDatabaseChain := chains.NewSQLDatabaseChain(llm, 100, db) ctx := context.Background() s, err := sqlDatabaseChain.Call( ctx, map[string]any{ "query": "who has the most logins?", }, ) if err != nil { panic(err) // PANICS HERE } fmt.Println(s) return nil }
+1
I made a little project with ollama and sqlite
when I call the chain the generated sqlstring is wrapped in backtics and the call fails with a syntax error