Skip to main content

UI-independent AI chatbot core with geophysics profile and local context retrieval.

Project description

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/*

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.2.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.2.0-py3-none-any.whl (1.4 MB view details)

Uploaded Python 3

File details

Details for the file polaris_core-0.2.0.tar.gz.

File metadata

  • Download URL: polaris_core-0.2.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.2.0.tar.gz
Algorithm Hash digest
SHA256 e7b897fff45ce8979a3f79b4fdcb4ca7ead2e039707d56b8a90389cf25b92fa4
MD5 238ab0d79e23d2f8fcafbfff468ba7ed
BLAKE2b-256 c45e6139928cca0dae3d4ffbd02bcd59f988aeecc26c32d4ca2f4e7c0a0d4436

See more details on using hashes here.

Provenance

The following attestation bundles were made for polaris_core-0.2.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.2.0-py3-none-any.whl.

File metadata

  • Download URL: polaris_core-0.2.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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 51e6fac21691162405aac950f32e083d446c06387690450f4fd8474a4e0bf8e7
MD5 73b0aba9939960f133b2fc9787102355
BLAKE2b-256 11323152893a1fb60b9231a097d25d0ae50e83011e4c920022d8294d121574e6

See more details on using hashes here.

Provenance

The following attestation bundles were made for polaris_core-0.2.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