Skip to content

[Go] Dotprompt snake case #3604

@jannwitt

Description

@jannwitt

Describe the bug

When passing a Go struct as prompt input to .prompt, fields tagged with snake_case (e.g., org_name, date_range) are silently missing in the rendered prompt. No error is thrown. Using camelCase works.

To Reproduce

  1. example.prompt
---
model: openai/gpt-4.1-mini
input:
  schema:
    items(array):
      org_name: string
      date_range: string
---
{{#each items as |it|}}
Org: {{ it.org_name }}
Range: {{ it.date_range }}
{{/each}}
  1. Go
	prompt := genkit.LookupPrompt(Genkit, promptName)
	if prompt == nil {
		return nil, fmt.Errorf("prompt %s not found", promptName)
	}

	actionOpts, err := prompt.Render(ctx, input)
	if err != nil {
		return nil, fmt.Errorf("error rendering prompt: %w", err)
	}

Log the action options and see that org and date range are missing from the parsed prompt.

  1. Control: Works if using camelCase (template + struct tags): orgName, dateRange.

Expected behavior

Snake_case JSON keys should be available in the template per struct tags; the rendered prompt should include the values or report a validation error if mismatched.

Environment

  • OS: macOS (darwin/arm64)
  • Go: 1.25.1
  • Genkit (Go): 0.7.x

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinggo

Type

No type

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions