Skip to main content

castor-pollux

Castor-Pollux (the twin sons of Zeus, routinely called 'gemini') is a pure REST API library for interacting with Google Generative AI API.

Without (!!!):

  • any whiff of 'Vertex' or GCP;
  • any signs of 'Pydantic' or unnecessary (and mostly useless) typing;
  • any other dependencies of other google packages trashed into the dumpster google-genai package.

Installation:

  pip install castor-pollux

Then:

  # Python
  import castor_pollux.rest as cp

A text continuation request:

import castor_pollux.rest as cp
from yaml import safe_load as yl

kwargs = """  # this is a string in YAML format
  model:        gemini-3.1-pro-preview      # thingking model
  # system_instruction: ''                  # will prevail if put here
  mime_type:    text/plain                  #
  modalities:
    - TEXT                                  # text for text
  max_tokens:   10000
  n:            2                           # 1 is not mandatory
  stop_sequences:
    - STOP
    - "\nTitle"
  temperature:  0.5                         # 0 to 1.0
  top_k:        10                          # number of tokens to consider.
  top_p:        0.5                         # 0 to 1.0
  include_thoughts: True
  thinking_level: high                      # for 3+ models
  sources: True                             # add url_context tool
"""

instruction = 'You are Joseph Jacobs, you retell folk tales.'

message = [{"role": "user", "content": 'Once upon a time, when pigs drank wine '}]

machine_responses = cp.continuation(
    messages=message,
    instructions=instruction,
    **yl(kwargs)
)

A multi-turn continuation:

import castor_pollux.rest as cp
from yaml import safe_load as yl

kwargs = """  # this is a string in YAML format
  model:        gemini-2.5-pro
  mime_type:    text/plain
  modalities:
    - TEXT
  max_tokens:   32000
  n:            1  # no longer a mandatory 1
  stop_sequences:
    - STOP
    - "\nTitle"
  temperature:  0.5
  top_k:        10
  top_p:        0.5
  include_thoughts: True
  thinking_budget: 32768
"""

# No f...ing 'parts'!
previous_turns = """
  - role: user
    content: Can we change human nature?
    
  - role: model
    content: Of course, nothing can be simpler. You just re-educate them.
"""

human_response_to_the_previous_turn = 'That is not true. Think again.'

instruction = 'I am an expert in critical thinking. I analyse.'

machine_responses = cp.continuation(
    messages=yl(previous_turns),
    instructions=instruction,
    **yl(kwargs)
)

Metadata

Release files for castor-pollux 0.1.4

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

Source distribution (sdist)

Source distribution for castor-pollux 0.1.4
File Size Uploaded Provenance
castor_pollux-0.1.4.tar.gz 5.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for castor-pollux 0.1.4
File Interpreter ABI Platform
castor_pollux-0.1.4-py3-none-any.whl Python 3 none any Details

Total release size: 11.7 kB

Release files / castor_pollux-0.1.4.tar.gz

Download URL castor_pollux-0.1.4.tar.gz
Size 5.4 kB
Tags Source
SHA-256 checksum
How to use checksums
7b37268094643fc55c7b5496a48e2fe08150c80c3cdcdc1803df73f9382b1540
BLAKE2b-256 checksum
How to use checksums
3a5f455abae4eda99237fd7fa03a0ee1809eda40be88d5390f42502f3ef4b199
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.25

Release files / castor_pollux-0.1.4-py3-none-any.whl

Download URL castor_pollux-0.1.4-py3-none-any.whl
Size 6.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
131039fd23ba37494f9bb80c2503537a92b9f7468d11a16da159162cc338aabd
BLAKE2b-256 checksum
How to use checksums
f5d45e385236510ca4c9e96704fac68e49478c898c623c631ed939d85c6f99b6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.25

Security for castor-pollux 0.1.4

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.1.4 This release

2 release files No provenance

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