pydantic
Identity echo for evaluation/benchmarking
pydantic/pipeline.plumb
(* Identity pipeline for evaluation — echoes input as output. *)
let main : !json -> !json = plumb(input, output) {
spawn id(input, output)
}
pydantic/bare.py
"""Identity pipeline — bare API.
Sends a message through an identity pipeline that echoes input
as output. No API key required.
Usage:
python bare.py
"""
from pathlib import Path
import plumbing as pb
spec = Path(__file__).parent / "pipeline.plumb"
results = pb.call_sync(spec, "hello from bare API")
for result in results:
print(result)
pydantic/eval.py
"""Identity pipeline via Pydantic AI Agent.
PlumbingModel is an interop adapter for the Pydantic AI ecosystem;
see bare.py for the canonical bare API interface.
Demonstrates using a plumbing pipeline as a Pydantic AI model,
suitable for evaluation and benchmarking. The identity pipeline
echoes input as output — no API key required.
Usage:
pip install plumbing[pydantic]
python eval.py
"""
import asyncio
from pathlib import Path
from pydantic_ai import Agent
from plumbing.provider import PlumbingModel
async def main() -> None:
spec = Path(__file__).parent / "pipeline.plumb"
async with PlumbingModel(spec) as model:
agent = Agent(model)
# First request.
result1 = await agent.run("hello")
print(f"Response 1: {result1.output}")
# Second request — same pipeline, preserves state.
result2 = await agent.run(
"world", message_history=result1.all_messages()
)
print(f"Response 2: {result2.output}")
print(f"Model: {model.model_name}")
if __name__ == "__main__":
asyncio.run(main())