Skip to main content

No project description provided

Project description

pico-dspy

A stripped-down version of dspy: https://github.com/stanfordnlp/dspy

Use case

dspy may be too bulky and slow to import in some cases, especially during highly iterative development with code auto reloaders. pico-dspy lets you use the usual signature+predict flow during development and switch your dspy-compatible signatures to the regular dspy when you need GEPA, fine tuning, etc.

Limitations

Several features or limitations compared to dspy:

  • uses pydantic-ai instead of litellm, as litellm is infamously slow to import (https://github.com/BerriAI/litellm/issues/7605)

  • uses lazy imports (with wrapt) to reduce import time

  • just inference, no GEPA or anything

  • only JSONAdapter, only one LM type

  • only Predict supported

  • text inference only

  • no tool support

  • no async api

  • no loading and saving

  • no caching

  • no dspy.configure

  • tested only with gemini

What works

import pico_dspy as dspy


class EmailParse(dspy.Signature):
    """
    Parse a raw email.
    """
    raw_email = dspy.InputField(desc="Raw email")
    subject = dspy.OutputField(desc="Email subject")
    body = dspy.OutputField(desc="Email text body")
    attachments: list[str] = dspy.OutputField(desc="Email text attachments")


RAW_EMAIL = """\
From : foo@example.net
To: bar@example.net
Subject: hello

Hello there
-- bar
"""

lm = dspy.LM('gemini/gemini-2.5-flash-lite')
pred = dspy.Predict(signature=EmailParse)
result = pred(lm=lm, raw_email=RAW_EMAIL)
print(dict(result))
print(result.get_lm_usage())

Install

pip install pico-dspy

Install your preferred variant of pydantic-ai, eg. pip install pydantic-ai-slim[google].

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

pico_dspy-0.2.tar.gz (17.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pico_dspy-0.2-py3-none-any.whl (20.4 kB view details)

Uploaded Python 3

File details

Details for the file pico_dspy-0.2.tar.gz.

File metadata

  • Download URL: pico_dspy-0.2.tar.gz
  • Upload date:
  • Size: 17.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pico_dspy-0.2.tar.gz
Algorithm Hash digest
SHA256 7951be8e1f9993e43b3b04ea0d70f2171bca19d126bba08825204e50b84a6093
MD5 e003433713c67ad901029cb445bdb23f
BLAKE2b-256 d796f32b812d3c6b6b51f9359e03a08c4af183fca5b70334173b43a5756167db

See more details on using hashes here.

Provenance

The following attestation bundles were made for pico_dspy-0.2.tar.gz:

Publisher: publish.yml on mbachry/pico-dspy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pico_dspy-0.2-py3-none-any.whl.

File metadata

  • Download URL: pico_dspy-0.2-py3-none-any.whl
  • Upload date:
  • Size: 20.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pico_dspy-0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e71184a0057f3e8c45427e9f677209476b6e7ad7059b70c44376f366e036fc7b
MD5 61259b4fad10a3738ff3d0e669a5167a
BLAKE2b-256 d4f94d8224cefaa5cbb7978942705f9189fbf0b6c3eadf2757928052b5952240

See more details on using hashes here.

Provenance

The following attestation bundles were made for pico_dspy-0.2-py3-none-any.whl:

Publisher: publish.yml on mbachry/pico-dspy

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