Skip to content

Commit

Permalink
Update chapter13.md
Browse files Browse the repository at this point in the history
  • Loading branch information
yogananda-muthaiah authored Dec 1, 2024
1 parent add25a2 commit 6eef5b0
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions chapter13.md
Original file line number Diff line number Diff line change
@@ -1 +1,19 @@
## Chapter 13: Database Integration
With LangChain, you can integrate with databases and build systems that answer questions based on structured data.

```
from langchain import OpenAI, SQLDatabase, SQLDatabaseChain
#
db = SQLDatabase.from_uri("sqlite:///chinook.db")
# LLM
llm = OpenAI(temperature=0)
#
db_chain = SQLDatabaseChain(llm=llm, database=db, verbose=True)
#
query = "How many tracks are there in the album with ID 1?"
print(db_chain.run(query))
```

0 comments on commit 6eef5b0

Please sign in to comment.