Is it just me or has the functions docs section be...
# daft-dev
e
Is it just me or has the functions docs section been moved? @Kevin Wang @Desmond Cheong
k
what do you mean?
e
from what I can tell its supposed to be in /docs/functions, but I don't see the folder there or in /api
When I click on the link it can't find it.
k
ahh. yeah in the docs it's actually programmatically generated
take a look at docs/gen_pages/gen_function_pages.py
🙏 1
e
@Kevin Wang Would it be unreasonable to add a structured ouputs usage pattern in the llm_generate doc string? Or should I skip it?
It would more than double it's current length
k
Hm, let's skip that for now. We need to think deeper about having a native structrued generation API, which will likely come via a new function.
Is your final tutorial using llm_generate with a Pydantic base model passed in? I remember you trying that but having trouble with it
e
It uses guided choice for now. I just also have the working patterns for both providers
k
gotcha. yeah we can just have it as an example for now
n
llm_generate with pydantic would be really useful. A very common use case… in fact a use case that I’m currently working on right now. Would love to see how you have done it.
e
Copy code
import daft
from daft.functions import llm_generate
from pydantic import BaseModel

model_id = "gpt-5-nano-2025-08-07"

class Step(BaseModel):
    explanation: str
    output: str


class MathResponse(BaseModel):
    steps: list[Step]
    final_answer: str

df = daft.from_pylist([
    {"text": "solve 8x + 31 = 2"},
])

df_result = df.with_column("result", llm_generate(
        "You are a helpful math tutor." + df["text"], 
        model=model_id,
        provider="openai",
        response_format={
            "type": "json_schema",
            "json_schema": {
                "name": "math-response",
                "schema": MathResponse.model_json_schema(),
            },
        },
    )
)

df_result_validated = df_result.with_column("pydantic_model_validated", df_result["result"].apply(
    lambda x: MathResponse.model_validate_json(x),
    return_dtype= daft.DataType.python()
))

df_result_validated.show()
Here is something for the interim!
@Navneeth Krishnan let me know if you are using vllm or vllm's openai online server. I have that too