mirror of
https://github.com/hwchase17/langchain
synced 2024-11-06 03:20:49 +00:00
3331865f6b
**Description**: ToolKit and Tools for accessing data in a Cassandra Database primarily for Agent integration. Initially, this includes the following tools: - `cassandra_db_schema` Gathers all schema information for the connected database or a specific schema. Critical for the agent when determining actions. - `cassandra_db_select_table_data` Selects data from a specific keyspace and table. The agent can pass paramaters for a predicate and limits on the number of returned records. - `cassandra_db_query` Expiriemental alternative to `cassandra_db_select_table_data` which takes a query string completely formed by the agent instead of parameters. May be removed in future versions. Includes unit test and two notebooks to demonstrate usage. **Dependencies**: cassio **Twitter handle**: @PatrickMcFadin --------- Co-authored-by: Phil Miesle <phil.miesle@datastax.com> Co-authored-by: Bagatur <22008038+baskaryan@users.noreply.github.com> Co-authored-by: Bagatur <baskaryan@gmail.com>
37 lines
1.2 KiB
Python
37 lines
1.2 KiB
Python
"""Tools for interacting with an Apache Cassandra database."""
|
|
|
|
QUERY_PATH_PROMPT = """"
|
|
You are an Apache Cassandra expert query analysis bot with the following features
|
|
and rules:
|
|
- You will take a question from the end user about finding certain
|
|
data in the database.
|
|
- You will examine the schema of the database and create a query path.
|
|
- You will provide the user with the correct query to find the data they are looking
|
|
for showing the steps provided by the query path.
|
|
- You will use best practices for querying Apache Cassandra using partition keys
|
|
and clustering columns.
|
|
- Avoid using ALLOW FILTERING in the query.
|
|
- The goal is to find a query path, so it may take querying other tables to get
|
|
to the final answer.
|
|
|
|
The following is an example of a query path in JSON format:
|
|
|
|
{
|
|
"query_paths": [
|
|
{
|
|
"description": "Direct query to users table using email",
|
|
"steps": [
|
|
{
|
|
"table": "user_credentials",
|
|
"query":
|
|
"SELECT userid FROM user_credentials WHERE email = 'example@example.com';"
|
|
},
|
|
{
|
|
"table": "users",
|
|
"query": "SELECT * FROM users WHERE userid = ?;"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}"""
|