dagster-gemini
A dagster module that provides integration with Gemini.
Installation
The dagster_gemini module is available as a PyPI package - install with your preferred python
environment manager (We recommend uv).
source .venv/bin/activate
uv pip install dagster-gemini
Example Usage
In addition to wrapping the Gemini GenerativeModel class (get_model/get_model_for_asset methods), this resource logs the usage of the Gemini API to to the asset metadata (both number of calls, and tokens). This is achieved by wrapping the GenerativeModel.generate_content method.
Note that the usage will only be logged to the asset metadata from an Asset context - not from an Op context. Also note that only the synchronous API usage metadata will be automatically logged - not the streaming or batching API.
from dagster import AssetExecutionContext, Definitions, EnvVar, asset, define_asset_job
from dagster_gemini import GeminiResource
@asset(compute_kind="gemini")
def gemini_asset(context: AssetExecutionContext, gemini: GeminiResource):
with gemini.get_model(context) as model:
response = model.generate_content(
"Generate a short sentence on tests"
)
defs = Definitions(
assets=[gemini_asset],
resources={
"gemini": GeminiResource(
api_key=EnvVar("GEMINI_API_KEY"),
generative_model_name="gemini-1.5-flash"
),
},
)
Development
The Makefile provides the tools required to test and lint your local installation
make test
make ruff
make check
Release files for dagster-gemini 0.0.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| dagster_gemini-0.0.6.tar.gz | 5.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| dagster_gemini-0.0.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.8 kB
Release files / dagster_gemini-0.0.6.tar.gz
| Download URL | dagster_gemini-0.0.6.tar.gz |
|---|---|
| Size | 5.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b618ff460516b3f1aa096675eb20d40d66be3e64028cd6abe8cbfb47cf62cd63
|
|
BLAKE2b-256 checksum How to use checksums |
2169ab9fd88916e529022774b01cdf218f14f3322491a3809a6cab5f6917de45
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / dagster_gemini-0.0.6-py3-none-any.whl
| Download URL | dagster_gemini-0.0.6-py3-none-any.whl |
|---|---|
| Size | 5.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
600574c60acd124a78d710abd9e0c16bff7e604d17bea5fc1371294dbd2e712a
|
|
BLAKE2b-256 checksum How to use checksums |
aa4d3ffe8339da33c4cbfd4564dafd3a12dee9c1bb05c0f91a7c17bb152c4971
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|