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 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

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.1.tar.gz (35.5 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.1-py3-none-any.whl (43.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pico_dspy-0.1.tar.gz
  • Upload date:
  • Size: 35.5 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.1.tar.gz
Algorithm Hash digest
SHA256 d6922183c9fd80afac2c9bba879a839b1e764df207265f8d23bf2ba27829fb9d
MD5 c5ceb88351277582ce07d2fd8c770a89
BLAKE2b-256 f668e8654209e274c271397b4d38921d04d8be42f3cddd48dda133da61b6eaa3

See more details on using hashes here.

Provenance

The following attestation bundles were made for pico_dspy-0.1.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.1-py3-none-any.whl.

File metadata

  • Download URL: pico_dspy-0.1-py3-none-any.whl
  • Upload date:
  • Size: 43.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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7dc3e2bceed0d19aed69ba2fd3d61fc77fa651cd4d22392bc524e122dced145d
MD5 5c7703f3cb4c4a99a311fd309495b8b9
BLAKE2b-256 7f4a97470892f0a76a7044cec7ceab52819cffb070916f8f558e37e36dfca7f3

See more details on using hashes here.

Provenance

The following attestation bundles were made for pico_dspy-0.1-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