kg_chat package
Subpackages
- kg_chat.implementations package
- Submodules
- kg_chat.implementations.duckdb_implementation module
DuckDBImplementation
DuckDBImplementation.clear_database()
DuckDBImplementation.create_edges()
DuckDBImplementation.create_nodes()
DuckDBImplementation.execute_query()
DuckDBImplementation.execute_query_using_langchain()
DuckDBImplementation.execute_unsafe_operation()
DuckDBImplementation.get_human_response()
DuckDBImplementation.get_structured_response()
DuckDBImplementation.is_safe_command()
DuckDBImplementation.load_kg()
DuckDBImplementation.show_schema()
DuckDBImplementation.toggle_safe_mode()
- kg_chat.implementations.neo4j_implementation module
Neo4jImplementation
Neo4jImplementation.clear_database()
Neo4jImplementation.create_edges()
Neo4jImplementation.create_nodes()
Neo4jImplementation.ensure_index()
Neo4jImplementation.execute_query()
Neo4jImplementation.execute_query_using_langchain()
Neo4jImplementation.execute_unsafe_operation()
Neo4jImplementation.get_human_response()
Neo4jImplementation.get_structured_response()
Neo4jImplementation.initialize_agent()
Neo4jImplementation.is_safe_command()
Neo4jImplementation.load_kg()
Neo4jImplementation.show_schema()
Neo4jImplementation.toggle_safe_mode()
- Module contents
DuckDBImplementation
DuckDBImplementation.clear_database()
DuckDBImplementation.create_edges()
DuckDBImplementation.create_nodes()
DuckDBImplementation.execute_query()
DuckDBImplementation.execute_query_using_langchain()
DuckDBImplementation.execute_unsafe_operation()
DuckDBImplementation.get_human_response()
DuckDBImplementation.get_structured_response()
DuckDBImplementation.is_safe_command()
DuckDBImplementation.load_kg()
DuckDBImplementation.show_schema()
DuckDBImplementation.toggle_safe_mode()
Neo4jImplementation
Neo4jImplementation.clear_database()
Neo4jImplementation.create_edges()
Neo4jImplementation.create_nodes()
Neo4jImplementation.ensure_index()
Neo4jImplementation.execute_query()
Neo4jImplementation.execute_query_using_langchain()
Neo4jImplementation.execute_unsafe_operation()
Neo4jImplementation.get_human_response()
Neo4jImplementation.get_structured_response()
Neo4jImplementation.initialize_agent()
Neo4jImplementation.is_safe_command()
Neo4jImplementation.load_kg()
Neo4jImplementation.show_schema()
Neo4jImplementation.toggle_safe_mode()
- kg_chat.interface package
- Submodules
- kg_chat.interface.database_interface module
DatabaseInterface
DatabaseInterface.clear_database()
DatabaseInterface.create_edges()
DatabaseInterface.create_nodes()
DatabaseInterface.execute_query()
DatabaseInterface.execute_query_using_langchain()
DatabaseInterface.execute_unsafe_operation()
DatabaseInterface.get_human_response()
DatabaseInterface.get_structured_response()
DatabaseInterface.is_safe_command()
DatabaseInterface.load_kg()
DatabaseInterface.show_schema()
DatabaseInterface.toggle_safe_mode()
- Module contents
DatabaseInterface
DatabaseInterface.clear_database()
DatabaseInterface.create_edges()
DatabaseInterface.create_nodes()
DatabaseInterface.execute_query()
DatabaseInterface.execute_query_using_langchain()
DatabaseInterface.execute_unsafe_operation()
DatabaseInterface.get_human_response()
DatabaseInterface.get_structured_response()
DatabaseInterface.is_safe_command()
DatabaseInterface.load_kg()
DatabaseInterface.show_schema()
DatabaseInterface.toggle_safe_mode()
- kg_chat.schema package
Submodules
kg_chat.app module
Dash based app for the KG Chatbot.
- kg_chat.app.create_app(kg_chatbot)
Create a Dash app for the KG Chatbot.
kg_chat.cli module
Command line interface for kg-chat.
kg_chat.constants module
Constants for the Knowledge Graph Chatbot.
kg_chat.main module
Main module for the KG Chat application.
- class kg_chat.main.KnowledgeGraphChat(db)
Bases:
object
Main class for the KG Chatbot application.
- chat()
Start an interactive chat session with the KG Chatbot.
- execute_query(query)
Execute a Cypher query against the Neo4j database.
- get_human_response(query)
Ask a question to the KG Chatbot and get a response.
- get_structured_response(query)
Ask a question to the KG Chatbot and get a structured response.
- load_database()
Load the Knowledge Graph into the database.
kg_chat.utils module
Utility functions for the KG chatbot.
- kg_chat.utils.assign_color_to_prefix(curie)
Assign a color to a prefix.
- kg_chat.utils.create_vectorstore(doc_dir_or_file)
Create a vectorstore from the documents in the doc_dir.
- Return type:
Chroma
- kg_chat.utils.extract_nodes_edges(structured_result)
Extract nodes and edges from the structured result.
- kg_chat.utils.generate_random_color()
Generate a random color.
- kg_chat.utils.get_anthropic_models()
Get the list of Anthropic models.
- kg_chat.utils.get_cypher_agent_prompt_template()
Get the agent prompt for querying a Neo4J database.
- kg_chat.utils.get_database_impl(database, data_dir, llm_config, doc_dir_or_file=None)
Get the database implementation based on the selected database.
- kg_chat.utils.get_exisiting_vectorstore()
Get the existing vectorstore.
- kg_chat.utils.get_lbl_cborg_models()
Get the list of LBNL-hosted models via CBORG.
- kg_chat.utils.get_llm_config(llm_provider, llm_model=None)
Get the LLM configuration based on the selected LLM.
- kg_chat.utils.get_ollama_models()
Get the list of Ollama models.
- kg_chat.utils.get_openai_models()
Get the list of OpenAI models.
- kg_chat.utils.get_sql_agent_prompt_template()
Get the agent prompt.
- kg_chat.utils.llm_factory(config)
Create an LLM instance based on the configuration.
- kg_chat.utils.split_documents(path)
Get the local documents.
- kg_chat.utils.structure_query(query)
Structure the query to request structured results.
- Return type:
str
- kg_chat.utils.visualize_kg(nodes, edges, app=False, output_dir=None)
Visualize the knowledge graph using pyvis.
Module contents
kg-chat package.