Skip to main content

PolarisCore

UI-independent Python library for building Polaris: an AI chatbot with a configurable geophysics profile, local document retrieval (RAG), and a CLI.

Not tied to any specific frontend. Any app can install the package, pass runtime context, and choose its own UI.

Install

pip install polaris-core[llm]

For local development:

pip install -e ".[dev,llm]"

Quick Start

polaris configure --provider google --model gemini/gemini-2.5-flash
polaris ask "What is acoustic impedance?"

CLI Reference

polaris configure — save provider and API key

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

Omit --api-key to enter it securely at the prompt. Or pass it directly:

polaris configure --provider google --api-key "YOUR_KEY"

polaris ask — ask a question

polaris ask "How do checkshots help seismic well ties?"

# Short form — 'ask' can be omitted
polaris "Explain seismic inversion."

Use the built-in geophysics document store and your own uploaded docs for RAG:

polaris ask --docs "How does acoustic impedance relate to porosity?"

Use a specific file or directory instead:

polaris ask --docs "C:\path\to\reports" "Summarize the uploaded reports."

polaris docs — manage the user document store

Documents added here are stored outside the repository and included automatically whenever --docs is used without a path.

# Add a file or an entire directory
polaris docs add relatorio.pdf
polaris docs add C:\meus-docs\geofisica\

# List stored documents
polaris docs list

# Remove a document
polaris docs remove relatorio.pdf

# Show where the store lives on disk
polaris docs path

Storage location:

  • Windows: %APPDATA%\PolarisCore\docs\
  • Linux / macOS: ~/.local/share/polaris-core/docs/

polaris models — list available models

polaris models
polaris models --provider google
polaris models --provider google --live   # query the provider API

polaris config — show current configuration

polaris config
polaris config --json

Environment Variables

Environment variables override stored API keys:

GEMINI_API_KEY=YOUR_KEY
OPENAI_API_KEY=YOUR_KEY
ANTHROPIC_API_KEY=YOUR_KEY
DEEPSEEK_API_KEY=YOUR_KEY
POLARIS_MODEL=gemini/gemini-2.5-flash

Library Usage

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)

Create a provider explicitly:

from polaris_core import 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")

Use the document store from Python:

from polaris_core import LocalRetriever

retriever = LocalRetriever.from_user_docs()               # user store only
retriever = LocalRetriever.from_packaged_and_user_docs()  # bundled + user store
retriever = LocalRetriever.from_path("C:/path/to/docs")   # explicit path

List available models:

from polaris_core import list_available_models

for model in list_available_models("google"):
    print(model.model, model.description)

Publishing

This repository uses a GitHub Actions workflow at .github/workflows/publish.yml.

  • On push / PR: builds, tests, and uploads artifacts.
  • On GitHub Release: publishes automatically to PyPI via Trusted Publisher.

Setup:

  1. Create polaris-core on PyPI and configure a Trusted Publisher for this repository.
  2. Add a GitHub environment named pypi.
  3. Publish a GitHub Release to trigger the upload.

To build and check locally:

python -m build
python -m twine check dist/*

Release files for polaris-core 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for polaris-core 0.2.0
File Size Uploaded
polaris_core-0.2.0.tar.gz 1.4 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for polaris-core 0.2.0
File Interpreter ABI Platform
polaris_core-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 2.9 MB

Release files / polaris_core-0.2.0.tar.gz

Download URL polaris_core-0.2.0.tar.gz
Size 1.4 MB
Tags Source
SHA-256 checksum
How to use checksums
e7b897fff45ce8979a3f79b4fdcb4ca7ead2e039707d56b8a90389cf25b92fa4
BLAKE2b-256 checksum
How to use checksums
c45e6139928cca0dae3d4ffbd02bcd59f988aeecc26c32d4ca2f4e7c0a0d4436
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 21, 2026.

Transparency log

Release files / polaris_core-0.2.0-py3-none-any.whl

Download URL polaris_core-0.2.0-py3-none-any.whl
Size 1.4 MB
Tags Python 3
SHA-256 checksum
How to use checksums
51e6fac21691162405aac950f32e083d446c06387690450f4fd8474a4e0bf8e7
BLAKE2b-256 checksum
How to use checksums
11323152893a1fb60b9231a097d25d0ae50e83011e4c920022d8294d121574e6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 21, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page