Skip to content

createStructuredFewShot prompt helper #2696

Closed
@lgrammel

Description

@lgrammel

Feature Description

const messages = [
   system: "you are weather bot. be concise.",
   user: "what is the weather in France?",
   createStructuredFewShot(getWeatherTool, [{
      arguments: {
          location: "France" // type-safe from tool zod schema
      },
      response: {
          weather: "30 C" // type-safe from tool's execute return
      } 
   }],
   assistant: "The weather in France is 30 C",
   user: "what is the weather in California?"
]

ideally the arguments/response types are inferred from the schema and ReturnType of the tool. This will create the example tool call messages and make writing few shot examples very easy for structured outputs (edited)

Use Case

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions