Shows how to list and retrieve prompts with their content.
This example assumes using HammingAI; is in scope and apiKey contains your HammingAI API key.
1 2 3 4 5 6 7 8 910111213141516171819202122
usingvarclient=newHammingAIClient(apiKey);// List all prompts in the workspace.varpromptsList=awaitclient.Prompts.ListPromptsAsync();Console.WriteLine($"Found {promptsList.Prompts!.Count} prompts.");// Get a specific prompt by slug to see its content.if(promptsList.Prompts.Count>0){varslug=promptsList.Prompts[0].Slug!;varpromptResponse=awaitclient.Prompts.GetPromptAsync(slug:slug);varpromptValue=promptResponse.Prompt!.Value;Console.WriteLine($"Prompt slug: {promptValue.Value1?.Slug}");if(promptValue.Value2?.Contentisnotnull){Console.WriteLine($"Model: {promptValue.Value2.Content.LanguageModel}");Console.WriteLine($"Messages: {promptValue.Value2.Content.ChatMessages?.Count ?? 0}");}}