ai

package
v0.0.0-...-ecfd043 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 19, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GCPClient

type GCPClient struct {
	PredictionClient   *aiplatform.PredictionClient
	TextToSpeechClient *texttospeech.Client
	PredictURL         string
}

func (GCPClient) GenerateAudio

func (c GCPClient) GenerateAudio(ctx context.Context, story string) ([]byte, error)

func (GCPClient) GenerateImage

func (c GCPClient) GenerateImage(ctx context.Context, story string) (string, error)

func (GCPClient) GenerateImagePrompt

func (c GCPClient) GenerateImagePrompt(ctx context.Context, story string) (string, error)

func (GCPClient) GenerateStory

func (c GCPClient) GenerateStory(ctx context.Context, params StoryParams) (string, error)

type GPTResponse

type GPTResponse struct {
	Choices []struct {
		Message struct {
			Role    string `json:"role"`
			Content string `json:"content"`
		} `json:"message"`
		FinishReason string `json:"finish_reason"`
		Index        int    `json:"index"`
	} `json:"choices"`
	Data []struct {
		URL string `json:"url"`
	} `json:"data"`
}

type GeminiClient

type GeminiClient struct {
	GenAIClient        *genai.Client
	TextToSpeechClient *texttospeech.Client
}

func (GeminiClient) GenerateAudio

func (c GeminiClient) GenerateAudio(ctx context.Context, story string) ([]byte, error)

func (GeminiClient) GenerateImage

func (c GeminiClient) GenerateImage(ctx context.Context, story string) (string, error)

func (GeminiClient) GenerateImagePrompt

func (c GeminiClient) GenerateImagePrompt(ctx context.Context, story string) (string, error)

func (GeminiClient) GenerateStory

func (c GeminiClient) GenerateStory(ctx context.Context, params StoryParams) (string, error)

type OpenAIClient

type OpenAIClient struct {
	OpenAIKey string
}

func (OpenAIClient) GenerateAudio

func (c OpenAIClient) GenerateAudio(_ context.Context, story string) ([]byte, error)

func (OpenAIClient) GenerateImage

func (c OpenAIClient) GenerateImage(_ context.Context, imagePrompt string) (string, error)

func (OpenAIClient) GenerateImagePrompt

func (c OpenAIClient) GenerateImagePrompt(_ context.Context, story string) (string, error)

func (OpenAIClient) GenerateStory

func (c OpenAIClient) GenerateStory(_ context.Context, params StoryParams) (string, error)

type PereBodulClient

type PereBodulClient interface {
	GenerateStory(ctx context.Context, params StoryParams) (string, error)
	GenerateAudio(ctx context.Context, story string) ([]byte, error)
	GenerateImage(ctx context.Context, imagePrompt string) (string, error)
	GenerateImagePrompt(ctx context.Context, story string) (string, error)
}
var AIPlatform PereBodulClient
var Gemini PereBodulClient
var OpenAI PereBodulClient

type PereBodulImpl

type PereBodulImpl string
var GCPImpl PereBodulImpl = "gcp"
var GeminiImpl PereBodulImpl = "gemini"
var OpenAIImpl PereBodulImpl = "openai"

type StoryParams

type StoryParams struct {
	Hero     string
	Villain  string
	Location string
	Objects  string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL