textgen

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FormatTiptap = "tiptap"
	FormatHTML   = "html"
)

Format constants for content types.

Variables

This section is empty.

Functions

This section is empty.

Types

type OpenAITextService

type OpenAITextService struct {
	// contains filtered or unexported fields
}

OpenAITextService implements TextGenerationService using any OpenAI-compatible API.

func NewOpenAITextService

func NewOpenAITextService(apiKey, baseURL, model string) *OpenAITextService

NewOpenAITextService creates a new OpenAI-compatible text generation service. baseURL is optional — pass "" to use the OpenAI default. model is the chat model name (e.g. "gpt-5-mini", "gpt-5.4-mini", "openai/gpt-5-mini" for OpenRouter).

func (*OpenAITextService) EnhanceText

func (s *OpenAITextService) EnhanceText(ctx context.Context, content, format, mediaContext string) (string, error)

EnhanceText takes existing content and returns an enhanced version. format controls the output format: "tiptap" (default) or "html". mediaContext is an optional string of available images injected into the prompt for HTML generation.

func (*OpenAITextService) TranslateText

func (s *OpenAITextService) TranslateText(ctx context.Context, content, sourceLang, targetLang, format string) (string, error)

TranslateText translates content from sourceLang to targetLang. format controls the output format: "tiptap" (default) or "html".

type TextGenerationService

type TextGenerationService interface {
	EnhanceText(ctx context.Context, content, format, mediaContext string) (string, error)
	TranslateText(ctx context.Context, content, sourceLang, targetLang, format string) (string, error)
}

TextGenerationService defines the interface for AI text generation services.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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