Documentation
¶
Overview ¶
Package azureaifoundry provides a comprehensive Azure AI Foundry plugin for Genkit Go. This plugin supports text generation and chat capabilities using Azure OpenAI and other models available through Azure AI Foundry.
Index ¶
- Constants
- func DefineCommonEmbedders(a *AzureAIFoundry, g *genkit.Genkit) map[string]ai.Embedder
- func DefineCommonModels(a *AzureAIFoundry, g *genkit.Genkit) map[string]ai.Model
- func Embedder(g *genkit.Genkit, name string) ai.Embedder
- func IsDefinedEmbedder(g *genkit.Genkit, name string) bool
- func IsDefinedModel(g *genkit.Genkit, name string) bool
- func Model(g *genkit.Genkit, name string) ai.Model
- type AzureAIFoundry
- type GeneratedImage
- type ImageGenerationRequest
- type ImageGenerationResponse
- type ModelDefinition
- type STTRequest
- type STTResponse
- type TTSRequest
- type TTSResponse
Constants ¶
const ( ModelDallE2 = "dall-e-2" ModelDallE3 = "dall-e-3" ModelGPTImageBeta = "gpt-image-1" )
Common model names for image generation
const ( ModelTTS1 = "tts-1" ModelTTS1HD = "tts-1-hd" ModelGPT4oMiniTTS = "gpt-4o-mini-tts" )
Common model names for text-to-speech
const ( ModelWhisper1 = "whisper-1" ModelGPT4oMiniTranscribe = "gpt-4o-mini-transcribe" ModelGPT4oTranscribe = "gpt-4o-transcribe" ModelGPT4oTranscribeDiarize = "gpt-4o-transcribe-diarize" )
Common model names for speech-to-text
Variables ¶
This section is empty.
Functions ¶
func DefineCommonEmbedders ¶
DefineCommonEmbedders is a helper to define commonly used Azure OpenAI embedding models
func DefineCommonModels ¶
DefineCommonModels is a helper to define commonly used Azure OpenAI models
func IsDefinedEmbedder ¶
IsDefinedEmbedder reports whether an embedder is defined.
func IsDefinedModel ¶
IsDefinedModel reports whether a model is defined.
Types ¶
type AzureAIFoundry ¶
type AzureAIFoundry struct {
Endpoint string // Azure AI Foundry endpoint URL (required)
APIKey string // API key for authentication (required if not using DefaultAzureCredential)
APIVersion string // Azure OpenAI API version (e.g., "2024-12-01-preview", "2024-02-01"). Defaults to "2024-12-01-preview" if not specified
Credential azcore.TokenCredential // Optional: Use Azure DefaultAzureCredential instead of API key
// contains filtered or unexported fields
}
AzureAIFoundry provides configuration options for the Azure AI Foundry plugin.
func (*AzureAIFoundry) DefineEmbedder ¶
DefineEmbedder defines an embedder in the registry.
func (*AzureAIFoundry) DefineModel ¶
func (a *AzureAIFoundry) DefineModel(g *genkit.Genkit, model ModelDefinition, info *ai.ModelInfo) ai.Model
DefineModel defines a model in the registry.
func (*AzureAIFoundry) Init ¶
func (a *AzureAIFoundry) Init(ctx context.Context) []api.Action
Init initializes the Azure AI Foundry plugin.
func (*AzureAIFoundry) Name ¶
func (a *AzureAIFoundry) Name() string
Name returns the provider name.
type GeneratedImage ¶ added in v1.1.0
type GeneratedImage struct {
URL string // URL of the generated image (if response_format=url)
B64JSON string // Base64-encoded image data (if response_format=b64_json)
RevisedPrompt string // The revised prompt used for this image
}
GeneratedImage represents a generated image
type ImageGenerationRequest ¶ added in v1.1.0
type ImageGenerationRequest struct {
Prompt string // The text prompt to generate images from
N int // Number of images to generate (1-10)
Size string // Size: "256x256", "512x512", "1024x1024", "1792x1024", "1024x1792"
Quality string // Quality: "standard" or "hd" (DALL-E 3 only)
Style string // Style: "vivid" or "natural" (DALL-E 3 only)
ResponseFormat string // Format: "url" or "b64_json"
}
ImageGenerationRequest represents a request to generate images
type ImageGenerationResponse ¶ added in v1.1.0
type ImageGenerationResponse struct {
Images []GeneratedImage // Generated images
RevisedPrompt string // The revised prompt used (DALL-E 3)
}
ImageGenerationResponse represents the response from image generation
type ModelDefinition ¶
type ModelDefinition struct {
Name string // Model deployment name in Azure AI Foundry
Type string // Type: "chat", "text"
MaxTokens int32 // Maximum tokens the model can handle (optional)
SupportsMedia bool // Whether the model supports media (images, audio) (optional)
}
ModelDefinition represents a model with its name and type.
type STTRequest ¶ added in v1.1.0
type STTRequest struct {
Audio []byte // The audio file content
Filename string // Filename with extension (e.g., "audio.mp3", "audio.wav") - required for format detection
Language string // Language code (e.g., "en", "es")
Prompt string // Optional text to guide the model's style
ResponseFormat string // Format: "json", "text", "srt", "verbose_json", "vtt"
Temperature float64 // Temperature (0 to 1)
}
STTRequest represents a speech-to-text request
type STTResponse ¶ added in v1.1.0
type STTResponse struct {
Text string // Transcribed text
Language string // Detected language
Duration float64 // Duration in seconds
}
STTResponse represents the speech-to-text response
type TTSRequest ¶ added in v1.1.0
type TTSRequest struct {
Input string // The text to synthesize
Voice string // Voice: "alloy", "echo", "fable", "onyx", "nova", "shimmer"
ResponseFormat string // Format: "mp3", "opus", "aac", "flac", "wav", "pcm"
Speed float64 // Speed (0.25 to 4.0)
}
TTSRequest represents a text-to-speech request
type TTSResponse ¶ added in v1.1.0
type TTSResponse struct {
Audio []byte // The audio data
}
TTSResponse represents the text-to-speech response
Directories
¶
| Path | Synopsis |
|---|---|
|
examples
|
|
|
basic
command
Package main demonstrates basic usage of the Azure AI Foundry plugin
|
Package main demonstrates basic usage of the Azure AI Foundry plugin |
|
chat
command
Package main demonstrates multi-turn chat conversation with Azure AI Foundry
|
Package main demonstrates multi-turn chat conversation with Azure AI Foundry |
|
common
Package common provides shared utilities for Azure AI Foundry examples
|
Package common provides shared utilities for Azure AI Foundry examples |
|
embeddings
command
Package main demonstrates embeddings generation with Azure AI Foundry
|
Package main demonstrates embeddings generation with Azure AI Foundry |
|
image_generation
command
Package main demonstrates image generation using genkit.Generate()
|
Package main demonstrates image generation using genkit.Generate() |
|
speech_to_text
command
Package main demonstrates speech-to-text using genkit.Generate()
|
Package main demonstrates speech-to-text using genkit.Generate() |
|
streaming
command
Package main demonstrates streaming text generation with Azure AI Foundry
|
Package main demonstrates streaming text generation with Azure AI Foundry |
|
text_to_speech
command
Package main demonstrates text-to-speech using genkit.Generate()
|
Package main demonstrates text-to-speech using genkit.Generate() |
|
tool_calling
command
Package main demonstrates tool calling (function calling) with Azure AI Foundry
|
Package main demonstrates tool calling (function calling) with Azure AI Foundry |
|
vision
command
Package main demonstrates vision (multimodal) capabilities with Azure AI Foundry
|
Package main demonstrates vision (multimodal) capabilities with Azure AI Foundry |