A library for 'gemini' language models without unnecessary dependencies.
Project description
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-genaipackage.
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
"""
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 continuation with sources:
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
sources:
- https://github.com/machina-ratiocinatrix
- https://github.com/alxfed
"""
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)
)
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
castor_pollux-0.1.0.tar.gz
(5.3 kB
view details)
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 castor_pollux-0.1.0.tar.gz.
File metadata
- Download URL: castor_pollux-0.1.0.tar.gz
- Upload date:
- Size: 5.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.25
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
378df375852c30d25b29c8030f2f502c77f199fbe5a2a7bb76522f835c3873e0
|
|
| MD5 |
ff582672c25991e9853ec3a94e404a35
|
|
| BLAKE2b-256 |
859217cfc52ab8b05e99f3852fe23ddbfae0b75e52cade4e67bf7f83d1948d7c
|
File details
Details for the file castor_pollux-0.1.0-py3-none-any.whl.
File metadata
- Download URL: castor_pollux-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.25
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5d66471a2324858e360344c74cc033c67f5768a78bbe705224009146f28bfc57
|
|
| MD5 |
25c1c05b119a6fd96886362637abbddf
|
|
| BLAKE2b-256 |
a431c384e7e1fbf78f10be420b03d5ffb97d2fd33b5c7759b5efef2a137e1b4a
|