Templates allow you to skip re-sending system prompts by storing them on the server.
1 // Create a template 2 tmpl, _ := client.Templates.Create(ctx, meshapi.CreateTemplateParams{ 3 Name: "support-agent", 4 System: "You are a helpful agent for {{company}}.", 5 Model: "openai/gpt-4o-mini", 6 }) 7 8 // Use it in a completion 9 resp, _ := client.Chat.Completions.Create(ctx, meshapi.ChatCompletionParams{ 10 Template: &tmpl.Name, 11 Variables: map[string]string{"company": "Acme Corp"}, 12 Messages: []meshapi.ChatMessage{{Role: "user", Content: "Hi!"}}, 13 })
1 // List 2 list, _ := client.Templates.List(ctx) 3 4 // Get 5 t, _ := client.Templates.Get(ctx, "uuid-or-name") 6 7 // Delete 8 _ = client.Templates.Delete(ctx, t.ID)