Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I would like to support version 2 of SQLAlchemy #11

Open
nasirus opened this issue Apr 10, 2023 · 1 comment
Open

I would like to support version 2 of SQLAlchemy #11

nasirus opened this issue Apr 10, 2023 · 1 comment

Comments

@nasirus
Copy link
Owner

nasirus commented Apr 10, 2023

I would like to support version 2 of SQLAlchemy.

@nasirus
Copy link
Owner Author

nasirus commented Apr 10, 2023

Thank you for your issue!

We can support version 2 of SQLAlchemy by creating a custom SQLAlchemyCache child class to customize the schema used for caching. To support high-speed fulltext prompt indexing with Postgres, you can use the code example provided in the issue.

You can also use SQLAlchemyCache to cache with any SQL database supported by SQLAlchemy. For example, you can use the example Chinook database to set up an LLM to answer questions over a database. To do this, follow the instructions on https://database.guide/2-sample-databases-sqlite/, placing the .db file in a notebooks folder at the root of this repository.

Note: For data-sensitive projects, you can specify return_direct=True in the SQLDatabaseChain initialization to directly return the output of the SQL query without any additional formatting. This prevents the LLM from seeing any contents within the database. Note, however, the LLM still has access to the database scheme (i.e. dialect, table and key names) by default.

I hope this helps! Let me know if you have any further questions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant