Documentation ¶
Index ¶
- type AI
- func (ai *AI) ExtractTextFromAudio(ctx context.Context, filePath string) (string, error)
- func (ai *AI) GenerateImageFromText(ctx context.Context, prompt string) (image.Image, error)
- func (ai *AI) GenerateImageURLFromText(ctx context.Context, prompt string) (string, error)
- func (ai *AI) GeneratePresentationFromText(ctx context.Context, preprompt string, content []byte) (*structure.Presentation, error)
- func (ai *AI) GenerateSlide(ctx context.Context, preprompt string, content []byte) (*structure.Slide, error)
- func (ai *AI) SimpleQuery(ctx context.Context, prompt string) (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AI ¶
type AI struct {
Client *openai.Client
}
AI represents a client for interacting with OpenAI's API.
func (*AI) ExtractTextFromAudio ¶
ExtractTextFromAudio extracts text from an audio file using OpenAI's Whisper model. It takes an audio file path as input and returns the transcribed text.
Parameters:
- ctx: The context for managing request deadlines and cancellation signals.
- filePath: The path to the audio file to be transcribed.
Returns:
- A string containing the transcribed text.
- An error if the transcription fails or if there is an issue with file handling.
func (*AI) GenerateImageFromText ¶
GenerateImageFromText generates a 256x256 image based on the provided text prompt. It communicates with OpenAI's API to create the image and returns it as an image.Image object.
Parameters:
- ctx: The context for managing request deadlines and cancellation signals.
- prompt: A string containing the description of the image to generate.
Returns:
- An image.Image object representing the generated image.
- An error if the image generation or processing fails.
func (*AI) GenerateImageURLFromText ¶
GenerateImageFromText generates a 256x256 image based on the provided text prompt. It communicates with OpenAI's API to create the image and returns it as an image.Image object.
Parameters:
- ctx: The context for managing request deadlines and cancellation signals.
- prompt: A string containing the description of the image to generate.
Returns:
- An image.Image object representing the generated image.
- An error if the image generation or processing fails.
func (*AI) GeneratePresentationFromText ¶
func (ai *AI) GeneratePresentationFromText(ctx context.Context, preprompt string, content []byte) (*structure.Presentation, error)
GeneratePresentationFromText generates a presentation from Markdown content