Skip to main content

A Lakehouse LLM Explorer. Wrapper for spark, databricks and langchain processes

Project description

Occlusion LLM Explorer

CodeQL python-ci python-cd PyPI version

Lakehouse Analytics & Advanced ML llm_explorer_sample

Setup

Important This package requires Open AI & HuggingFace API key

PyPi

python -m pip install llm-explorer
touch main.py
from llm_explorer import main

if __name__ == "__main__":
    main()
python -m streamlit run main.py

Initial load could take some time as it downloads the model and the tokenizer. Remember to include the secrets.toml file under .streamlit/ folder.

Build from source

Create a virtual environment

conda create -n occlusion python=3.10
conda activate occlusion

Install the requirements

pip install -r requirements.txt

Run the main.py script using streamlit:

python -m streamlit run main.py

Usage

Use the demo@occlusion.solutions user and DEMO@occlusion password to login.

The deployment requires a secrets.toml file created under .streamlit/:

touch .streamlit/secrets.toml

It should have a schema like this:

[connections.openai]
api_key="sk-..." # OpenAI API Key

[connections.huggingface]
api_key="shf_..." # HuggingFace API Key

[connections.databricks]
server_hostname="your databricks host"
http_path="http path under cluster JDBC/ODBC connectivity"
access_token="your databricks access token"

Lakehouse Agent Sample

Agent is queried for the top 10 producing wells. It identifies the tables it has access to and understands that the request could be satified by the padalloc table. It then creates a query that returns the top 10 producing assets and return the results.

> Entering new AgentExecutor chain...

Observation: logs, wells
Thought: I should look at the schema of the microchip_logs and padalloc tables to see what columns I can use.

Action: schema_sql_db
Action Input: "wells"
Observation: DDL
Thought: I should query the padalloc table to get the top 10 producing wells.

Action: query_sql_db
Action Input: "SELECT WELL_CODE, SUM(PROD_GAS_VOLUME_MCF) AS total_gas_volume_mcf FROM padalloc GROUP BY WELL_CODE ORDER BY total_gas_volume_mcf DESC LIMIT 10"
Observation: results_dataframe
Thought: I now know the top 10 producing wells.

Final Answer: The top 10 producing wells are 1222344, 1212560, 1222345, 1212503, 1222335, 1222340, 1222338, 1222367, 1220189, and 1222352.

> Finished chain.

Attribution

This is an adapted implementation from the GitHub repository. See the contibutions list for more details:

https://github.com/kaarthik108/snowChat

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

llm_explorer-0.0.5.tar.gz (36.5 kB view hashes)

Uploaded Source

Built Distribution

llm_explorer-0.0.5-py2.py3-none-any.whl (29.9 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page