basic-structured

command
v1.11.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 24, 2026 License: Apache-2.0 Imports: 10 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

This sample demonstrates structured input/output with strongly-typed Go structs. It shows GenerateStream for simple output and GenerateDataStream for typed JSON output with streaming partial results.

To run:

go run .

In another terminal, test a simple joke flow:

curl -N -X POST http://localhost:8080/simpleJokesFlow \
  -H "Content-Type: application/json" \
  -d '{"data": "bananas"}'

Test a structured joke flow (returns JSON):

curl -N -X POST http://localhost:8080/structuredJokesFlow \
  -H "Content-Type: application/json" \
  -d '{"data": {"topic": "bananas"}}'

Test a recipe flow:

curl -N -X POST http://localhost:8080/recipeFlow \
  -H "Content-Type: application/json" \
  -d '{"data": {"dish": "tacos", "cuisine": "Mexican", "servingSize": 4}}'

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL