they both accept nodes, curious where you saw that they dont π
But in any case, I would just use a pydantic program on its own, more control anyways
from llama_index.core.bridge.pydantic import BaseModel
from llama_index.program.openai import OpenAIPydanticProgram
class Category(BaseModel):
"""A category for a piece of text."""
name: str
program = OpenAIPydanticProgram.from_defaults(
output_cls=Category,
prompt_template_str="Given a piece of text, assign a category.\n\nText:\n{text}",
verbose=True,
)
category = program.run(text=node.text)
node.metadata['category'] = category.name