Skip to main content

haystack-pydantic

A thin wrapper around haystack Component and Pipeline for typing (outputs) with Pydantic models

from haystack_pydantic import Pipeline
from haystack_pydantic import component
from pydantic import BaseModel

class TestOutput(BaseModel):
    output1: str
    output2: str

@component
class TestComponent:
    # define pydantic model as output type (instead of the `output_types` decorator)
    def run(self, input1: str, input2: str) -> TestOutput:  
        return TestOutput(output1=input1, output2=input2)  # return the pydantic model

# use the component standalone
test_component = TestComponent()
test_component.run("input1", "input2")  # TestOutput(output1="input1", output2="input2")

# use the component within a pipeline
pipeline = Pipeline()
pipeline.add_component("test_component", test_component)
pipeline.run(data={"input1": "input1", "input2": "input2"})  # {"test_component": TestOutput(output1="input1", output2="input2")}

Metadata

Release files for haystack-pydantic 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for haystack-pydantic 0.1.0
File Size Uploaded
haystack_pydantic-0.1.0.tar.gz 3.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for haystack-pydantic 0.1.0
File Interpreter ABI Platform
haystack_pydantic-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 9.3 kB

Release files / haystack_pydantic-0.1.0.tar.gz

Download URL haystack_pydantic-0.1.0.tar.gz
Size 3.9 kB
Tags Source
SHA-256 checksum
How to use checksums
372f508c811cdbd88ed3b42f87ff1134c5c0e25ef4897802c0c59364b55bc585
BLAKE2b-256 checksum
How to use checksums
61fddd8c0372641bc55aae314dd41411b1534b05db9532fa4ddf88983817cd7a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.0.1 CPython/3.10.0 Windows/10

Release files / haystack_pydantic-0.1.0-py3-none-any.whl

Download URL haystack_pydantic-0.1.0-py3-none-any.whl
Size 5.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f70db77f064ecebc5adddd23af360d249041f2fd1aa37a9ef71ca62757cbf2d9
BLAKE2b-256 checksum
How to use checksums
2af7ba7262a6ed5468ccd0b7a4b616d3f197286b4f3ee074d5b750797f9e60b9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.0.1 CPython/3.10.0 Windows/10

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page