Skip to main content

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:

  1. Create the polaris-core project on PyPI.
  2. Add a Trusted Publisher for this GitHub repository.
  3. Use workflow file .github/workflows/publish.yml.
  4. Use the GitHub environment name pypi.
  5. 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


Download files

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

Source Distribution

polaris_core-0.1.0.tar.gz (1.4 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

polaris_core-0.1.0-py3-none-any.whl (1.4 MB view details)

Uploaded Python 3

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

Hashes for polaris_core-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9d95698467dda9c6014e2eee10c18944f089469b4e8adffe42481f6fb9dc8a39
MD5 9561bb4b4a41b05671cce76e53e76e63
BLAKE2b-256 cef54eba9a02a8c4f0d7c412521efdcabcab63363f7070f1a13a7c0c2648b3af

See more details on using hashes here.

Provenance

The following attestation bundles were made for polaris_core-0.1.0.tar.gz:

Publisher: publish.yml on albano-a/Polaris

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for polaris_core-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5498cdc3ded493c86c1dcb12c0ffbdd4ecbe6388f6ec7312b51e7dcf69b3583e
MD5 59e63db02290f6fb8412610ced2d4be1
BLAKE2b-256 1576066ef66ae213137961de9fcd73e7a08887efd7354ddcbaad3bef314922b3

See more details on using hashes here.

Provenance

The following attestation bundles were made for polaris_core-0.1.0-py3-none-any.whl:

Publisher: publish.yml on albano-a/Polaris

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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