UI-independent AI chatbot core with geophysics profile and local context retrieval.
Project description
PolarisCore
PolarisCore is a UI-independent Python library for building Polaris: an AI chatbot with a configurable geophysics profile, local document retrieval, and a simple CLI.
It is not tied to Andromeda. Any app can install the package, pass runtime context, and choose the UI.
Install
pip install polaris-core[llm]
For local development:
.\.venv\Scripts\python.exe -m pip install -e .[dev,llm]
CLI
List known models for all supported providers:
polaris models
Filter by provider:
polaris models --provider openai
polaris models --provider anthropic
polaris models --provider deepseek
polaris models --provider google
List models from the Google Gemini API using your configured key:
polaris models --provider google --live
Save an API key and model:
polaris configure --provider google --model gemini/gemini-2.5-flash
polaris configure --provider openai --model openai/gpt-4o-mini
polaris configure --provider anthropic --model anthropic/claude-sonnet-4-5
polaris configure --provider deepseek --model deepseek/deepseek-chat
You can also pass the key directly, although interactive entry is safer:
polaris configure --provider google --model gemini/gemini-2.5-flash --api-key "YOUR_KEY"
Ask a question:
polaris ask "What is acoustic impedance?"
The short form still works:
polaris "How do checkshots help seismic well ties?"
Use local uploaded context from text or PDF files:
polaris ask --docs "C:\path\to\docs" "Summarize the uploaded reports."
Pass --docs without a path to use the geophysics documents packaged with PolarisCore:
polaris ask "How does acoustic impedance relate to porosity?" --docs
Packaged references live in src/polaris_core/docs during development. PDFs, .txt, .md, and .rst files placed there are included in the installed package and used as retrieval context.
Show non-secret config:
polaris config
Environment Variables
Environment variables override stored API keys:
$env:GEMINI_API_KEY="YOUR_KEY"
$env:OPENAI_API_KEY="YOUR_KEY"
$env:ANTHROPIC_API_KEY="YOUR_KEY"
$env:DEEPSEEK_API_KEY="YOUR_KEY"
$env:POLARIS_MODEL="gemini/gemini-2.5-flash"
polaris ask "Explain seismic inversion."
Library Usage
Create a model explicitly:
from polaris_core import create_model
model = create_model(
model="gemini/gemini-2.5-flash",
api_key="YOUR_GOOGLE_API_KEY",
provider="google",
)
Or use provider convenience helpers:
from polaris_core import (
create_anthropic_model,
create_deepseek_model,
create_google_model,
create_openai_model,
)
model = create_google_model(api_key="YOUR_GOOGLE_API_KEY")
model = create_openai_model(api_key="YOUR_OPENAI_API_KEY")
model = create_anthropic_model(api_key="YOUR_ANTHROPIC_API_KEY")
model = create_deepseek_model(api_key="YOUR_DEEPSEEK_API_KEY")
Persist model configuration for later use:
from polaris_core import save_model_config
save_model_config(
model="gemini/gemini-2.5-flash",
api_key="YOUR_GOOGLE_API_KEY",
provider="google",
)
Create a ready-to-use service:
from polaris_core import AssistantContext, AssistantRequest, create_service
service = create_service(
model="gemini/gemini-2.5-flash",
api_key="YOUR_GOOGLE_API_KEY",
model_provider="google",
)
response = service.ask(
AssistantRequest(
message="Explain how checkshots help seismic well ties.",
context=AssistantContext(
title="Local study",
facts={"basin": "Campos Basin", "available_logs": ["DT", "RHOB", "GR"]},
),
)
)
print(response.content)
List suggested models from Python:
from polaris_core import list_available_models
for model in list_available_models("google"):
print(model.model, model.description)
Build And Upload
This repository includes a GitHub Actions workflow at .github/workflows/publish.yml.
It builds and tests on pushes and pull requests. It publishes to PyPI when a GitHub Release is published.
Recommended PyPI setup:
- Create the
polaris-coreproject on PyPI. - Add a Trusted Publisher for this GitHub repository.
- Use workflow file
.github/workflows/publish.yml. - Use the GitHub environment name
pypi. - Publish a GitHub Release to trigger the upload.
Build distributions:
python -m build
Check them:
python -m twine check dist/*
Upload to TestPyPI first:
python -m twine upload --repository testpypi dist/*
Upload to PyPI:
python -m twine upload dist/*
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file polaris_core-0.1.0.tar.gz.
File metadata
- Download URL: polaris_core-0.1.0.tar.gz
- Upload date:
- Size: 1.4 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9d95698467dda9c6014e2eee10c18944f089469b4e8adffe42481f6fb9dc8a39
|
|
| MD5 |
9561bb4b4a41b05671cce76e53e76e63
|
|
| BLAKE2b-256 |
cef54eba9a02a8c4f0d7c412521efdcabcab63363f7070f1a13a7c0c2648b3af
|
Provenance
The following attestation bundles were made for polaris_core-0.1.0.tar.gz:
Publisher:
publish.yml on albano-a/Polaris
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
polaris_core-0.1.0.tar.gz -
Subject digest:
9d95698467dda9c6014e2eee10c18944f089469b4e8adffe42481f6fb9dc8a39 - Sigstore transparency entry: 1677108206
- Sigstore integration time:
-
Permalink:
albano-a/Polaris@9d9f7f893411a292d59b74dea24e620954d58311 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/albano-a
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@9d9f7f893411a292d59b74dea24e620954d58311 -
Trigger Event:
release
-
Statement type:
File details
Details for the file polaris_core-0.1.0-py3-none-any.whl.
File metadata
- Download URL: polaris_core-0.1.0-py3-none-any.whl
- Upload date:
- Size: 1.4 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5498cdc3ded493c86c1dcb12c0ffbdd4ecbe6388f6ec7312b51e7dcf69b3583e
|
|
| MD5 |
59e63db02290f6fb8412610ced2d4be1
|
|
| BLAKE2b-256 |
1576066ef66ae213137961de9fcd73e7a08887efd7354ddcbaad3bef314922b3
|
Provenance
The following attestation bundles were made for polaris_core-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on albano-a/Polaris
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
polaris_core-0.1.0-py3-none-any.whl -
Subject digest:
5498cdc3ded493c86c1dcb12c0ffbdd4ecbe6388f6ec7312b51e7dcf69b3583e - Sigstore transparency entry: 1677108210
- Sigstore integration time:
-
Permalink:
albano-a/Polaris@9d9f7f893411a292d59b74dea24e620954d58311 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/albano-a
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@9d9f7f893411a292d59b74dea24e620954d58311 -
Trigger Event:
release
-
Statement type: