ai

package
v0.0.0-...-836e5e2 Latest Latest
Warning

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

Go to latest
Published: May 15, 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, _ StoryParams, story string) ([]byte, error)

func (GCPClient) GenerateImage

func (c GCPClient) GenerateImage(_ context.Context, _ StoryParams, _ string) (string, error)

func (GCPClient) GenerateImagePrompt

func (c GCPClient) GenerateImagePrompt(ctx context.Context, _ StoryParams, 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 OpenAIClient

type OpenAIClient struct {
	OpenAIKey string
}

func (OpenAIClient) GenerateAudio

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

func (OpenAIClient) GenerateImage

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

func (OpenAIClient) GenerateImagePrompt

func (c OpenAIClient) GenerateImagePrompt(_ context.Context, _ StoryParams, 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, params StoryParams, story string) ([]byte, error)
	GenerateImage(ctx context.Context, params StoryParams, imagePrompt string) (string, error)
	GenerateImagePrompt(ctx context.Context, params StoryParams, story string) (string, error)
}
var AIPlatform PereBodulClient // Deprecated
var OpenAI PereBodulClient
var VertexAI PereBodulClient

type StoryParams

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

type VertexAIClient

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

func (VertexAIClient) GenerateAudio

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

func (VertexAIClient) GenerateImage

func (c VertexAIClient) GenerateImage(_ context.Context, _ StoryParams, _ string) (string, error)

func (VertexAIClient) GenerateImagePrompt

func (c VertexAIClient) GenerateImagePrompt(ctx context.Context, params StoryParams, story string) (string, error)

func (VertexAIClient) GenerateStory

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

type Wizard

type Wizard string
const GeminiWizard Wizard = "gemini-pro"
const Llama3Wizard Wizard = "llama3"
const OpenAIWizard Wizard = "OpenAI"
const TextBizonWizard Wizard = "text-bison"

Jump to

Keyboard shortcuts

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