Getting Started
Installation
Or with pip:
Note: The package is published as
pyplaiton PyPI, but you import it asplaitin Python.
Quick start
from plait import Module, LLMInference, Parameter
from plait.resources import OpenAIEndpointConfig, ResourceConfig
class SummarizeAndAnalyze(Module):
def __init__(self):
super().__init__()
self.instructions = Parameter(
value="Be concise and highlight key insights.",
description="Controls the style of analysis output.",
)
self.summarizer = LLMInference(
alias="fast",
system_prompt="Summarize the input text concisely.",
)
self.analyzer = LLMInference(
alias="smart",
system_prompt=self.instructions,
)
def forward(self, text: str) -> str:
summary = self.summarizer(text)
return self.analyzer(f"Analyze this summary:\n{summary}")
resources = ResourceConfig(
endpoints={
"fast": OpenAIEndpointConfig(
model="gpt-4o-mini",
max_concurrent=20,
),
"smart": OpenAIEndpointConfig(
model="gpt-4o",
max_concurrent=5,
),
}
)
pipeline = SummarizeAndAnalyze().bind(resources=resources)
result = await pipeline("Your input text...")
Next steps
- Browse the Tutorials section for practical workflows.
- Use the API Reference to explore the full surface area.
- Dive into the Design docs to understand tracing, execution, and resources.