Dagster resource for Not Diamond ¬◇
Not Diamond is an AI model router that automatically determines which LLM is best-suited to respond to any query, improving LLM output quality by combining multiple LLMs into a meta-model that learns when to call each LLM.
Installation
pip install dagster-notdiamond
Configuration
Make sure you have followed the steps in the Quickstart docs, and added a Not Diamond API key to your environment.
Usage
Define a resource for Not Diamond, then create the asset:
from dagster import (
Definitions,
EnvVar,
ScheduleDefinition,
AssetSelection,
AssetExecutionContext,
MaterializeResult,
asset,
)
from dagster_notdiamond import NotDiamondResource
@asset
def notdiamond_asset(context: AssetExecutionContext, notdiamond: NotDiamondResource) -> MaterializeResult:
with notdiamond.get_client(context) as client:
session_id, best_llm = client.model_select(
model=["openai/gpt-4o", "openai/gpt-4o-mini"],
messages=[{"role": "user", "content": "Say this is a test"}]
)
return MaterializeResult(metadata={"session_id": session_id, "best_llm": str(best_llm)})
notdiamond_schedule = ScheduleDefinition(
name="notdiamond_schedule",
target=AssetSelection.all(),
cron_schedule="17 * * * *",
)
defs = Definitions(
assets=[notdiamond_asset],
resources={
"notdiamond": NotDiamondResource(api_key=EnvVar("NOTDIAMOND_API_KEY")),
},
schedules=[notdiamond_schedule],
)
Please refer to examples/example_notdiamond.py for an example script which you can test by updating
your pyproject.toml as follows (replacing $PROJECT_HOME with the path to this project):
[tool.dagster]
module_name = "examples.example_notdiamond"
working_directory = "$PROJECT_HOME/libraries/dagster-notdiamond/"
Support
Visit the documentation for Not Diamond or send a message to support@notdiamond.ai
Metadata
Release files for dagster-notdiamond 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| dagster_notdiamond-0.1.3.tar.gz | 3.8 kB | Without provenance | Details for dagster_notdiamond-0.1.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| dagster_notdiamond-0.1.3-py3-none-any.whl | Python 3 | none | any | Details for dagster_notdiamond-0.1.3-py3-none-any.whl |
Total release size: 8.4 kB
Release files / dagster_notdiamond-0.1.3.tar.gz
| Download URL | dagster_notdiamond-0.1.3.tar.gz |
|---|---|
| Size | 3.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
91a9bf0e04c146c924d8021fe5665a1fca5b0e6fdbfa41813e92e2fcd7be1727
|
|
BLAKE2b-256 checksum How to use checksums |
bb2ba16c401739eda3ccd01ed91ec0831a6362bd36ae5ffc5a8424f585ba52e4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.6.5
|
Release files / dagster_notdiamond-0.1.3-py3-none-any.whl
| Download URL | dagster_notdiamond-0.1.3-py3-none-any.whl |
|---|---|
| Size | 4.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
257460d2c70f2e54c466db6ad9625740655aa969bc37fb28c79eae4bb474b598
|
|
BLAKE2b-256 checksum How to use checksums |
affee0130098af7dfba41d6e266d84a162fb06c9f1b2490831bb0d2544500591
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.6.5
|
Security for dagster-notdiamond 0.1.3
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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.