basic-prompt-content

command
v1.14.0 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2026 License: Apache-2.0 Imports: 11 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 how a prompt turns your own data into a request. It fills all four content slots (system, conversation, user, and context documents) from one typed input, with the template form of each alongside.

The rule: template text is yours, so it is compiled; anything a function returns is content you already produced, so it is sent verbatim. Use a template when the wording is fixed and only values vary, and a function when the content depends on the data, such as branching on a field, trimming a conversation, attaching an image, or choosing documents.

Run it:

go run .

Or with the Dev UI, to see the assembled request in a trace of every run at http://localhost:4000/traces:

curl -sL cli.genkit.dev | bash    # install the Genkit CLI, once
genkit start -- go run .

Or over HTTP. Answer a question with a conversation behind it:

curl -N -X POST 'http://localhost:8080/supportFlow?stream=true' \
  -H "Content-Type: application/json" \
  -d '{"data": {"request": {"area": "billing", "tier": "pro", "question": "Why was I charged twice this month?"}, "history": [{"role": "user", "text": "Hi, I have a question about my bill."}, {"role": "model", "text": "Happy to help. What is going on?"}]}}'

Triage one into a structured verdict. This question contains handlebars syntax, which reaches the model as written:

curl -X POST http://localhost:8080/triageFlow \
  -H "Content-Type: application/json" \
  -d '{"data": {"request": {"area": "api", "tier": "free", "question": "How do I write {{#if}} in a prompt template?"}}}'

Jump to

Keyboard shortcuts

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