Documentation
¶
Index ¶
- Constants
- type APIKey
- type APIKeyListResponse
- type APIKeyScope
- type APIResponse
- type ApplyBundleRequest
- type BundlePreviewItem
- type BundlePreviewResponse
- type BundleStatusResponse
- type Client
- func (c *Client) Delete(ctx context.Context, path string) error
- func (c *Client) Get(ctx context.Context, path string, result interface{}) error
- func (c *Client) GetBaseURL() string
- func (c *Client) GetUserAgent() string
- func (c *Client) Health(ctx context.Context) error
- func (c *Client) Patch(ctx context.Context, path string, body interface{}, result interface{}) error
- func (c *Client) Post(ctx context.Context, path string, body interface{}, result interface{}) error
- func (c *Client) PostMultipart(ctx context.Context, path, contentType string, body []byte, result interface{}) error
- func (c *Client) Put(ctx context.Context, path string, body interface{}, result interface{}) error
- func (c *Client) SetTimeout(timeout time.Duration)
- func (c *Client) ValidateAPIKey(ctx context.Context) error
- func (c *Client) WithContext(ctx context.Context) context.Context
- type ClientOption
- type CreateStyleGuardWordRequest
- type CritiqueClient
- type CritiqueHistoryResponse
- type CritiquePlan
- type CritiqueRequest
- type CritiqueSuggestion
- type DraftAngle
- type DraftAnglePlan
- type DraftVariant
- type ErrorResponse
- type GenerateClient
- func (g *GenerateClient) Humanize(ctx context.Context, text, personaID string, createSession bool) (*GenerateTextResponse, error)
- func (g *GenerateClient) SimpleText(ctx context.Context, prompt string, personaID ...string) (string, error)
- func (g *GenerateClient) Text(ctx context.Context, request *GenerateTextRequest) (*GenerateTextResponse, error)
- func (g *GenerateClient) TextVariants(ctx context.Context, request *GenerateTextRequest) (*GenerateDraftsResponse, error)
- type GenerateDraftsResponse
- type GenerateTextRequest
- type GenerateTextResponse
- type ImperfectionSettings
- type KnowledgeCard
- type KnowledgeCardIngestResponse
- type KnowledgeCardListResponse
- type KnowledgeCardSource
- type KnowledgeCardSynthesis
- type KnowledgeClient
- func (k *KnowledgeClient) AssociateWithPersona(ctx context.Context, knowledgeCardID, personaID string) error
- func (k *KnowledgeClient) Create(ctx context.Context, knowledge *KnowledgeCard) (*KnowledgeCard, error)
- func (k *KnowledgeClient) CreateFromFile(ctx context.Context, filename string, content io.Reader, ...) (*KnowledgeCardIngestResponse, error)
- func (k *KnowledgeClient) CreateFromURL(ctx context.Context, rawURL, instructionsHint string) (*KnowledgeCardIngestResponse, error)
- func (k *KnowledgeClient) Delete(ctx context.Context, knowledgeCardID string) error
- func (k *KnowledgeClient) DisassociateFromPersona(ctx context.Context, knowledgeCardID, personaID string) error
- func (k *KnowledgeClient) Get(ctx context.Context, knowledgeCardID string) (*KnowledgeCard, error)
- func (k *KnowledgeClient) GetPersonaKnowledge(ctx context.Context, personaID string) ([]KnowledgeCard, error)
- func (k *KnowledgeClient) List(ctx context.Context) ([]KnowledgeCard, error)
- func (k *KnowledgeClient) Sources(ctx context.Context, knowledgeCardID string) ([]KnowledgeCardSource, error)
- func (k *KnowledgeClient) Update(ctx context.Context, knowledgeCardID string, knowledge *KnowledgeCard) (*KnowledgeCard, error)
- type ListOptions
- type PaginatedResponse
- type Persona
- type PersonaListResponse
- type PersonasClient
- func (p *PersonasClient) AssociateFiles(ctx context.Context, personaID string, fileIDs []string) error
- func (p *PersonasClient) Create(ctx context.Context, persona *Persona) (*Persona, error)
- func (p *PersonasClient) Delete(ctx context.Context, personaID string) error
- func (p *PersonasClient) DisassociateFiles(ctx context.Context, personaID string, fileIDs []string) error
- func (p *PersonasClient) Get(ctx context.Context, personaID string) (*Persona, error)
- func (p *PersonasClient) List(ctx context.Context) ([]Persona, error)
- func (p *PersonasClient) ListBuiltIn(ctx context.Context) ([]Persona, error)
- func (p *PersonasClient) ListFiles(ctx context.Context, personaID string) ([]TrainingFile, error)
- func (p *PersonasClient) Update(ctx context.Context, personaID string, persona *Persona) (*Persona, error)
- type Quota
- type RateLimitError
- type Recipe
- type RecipeRequest
- type RecipeSuggestionRequest
- type RecipesClient
- func (r *RecipesClient) Create(ctx context.Context, request *RecipeRequest) (*Recipe, error)
- func (r *RecipesClient) List(ctx context.Context) ([]Recipe, error)
- func (r *RecipesClient) Suggest(ctx context.Context, request *RecipeSuggestionRequest) (*Recipe, error)
- func (r *RecipesClient) Update(ctx context.Context, recipeID string, request *RecipeRequest) (*Recipe, error)
- type StyleGuardClient
- func (s *StyleGuardClient) BundleApply(ctx context.Context, req *ApplyBundleRequest) error
- func (s *StyleGuardClient) BundlePreview(ctx context.Context, bundleType string) (*BundlePreviewResponse, error)
- func (s *StyleGuardClient) BundleRemove(ctx context.Context, personaID string) error
- func (s *StyleGuardClient) BundleStatus(ctx context.Context, personaID, bundleType string) (*BundleStatusResponse, error)
- func (s *StyleGuardClient) Create(ctx context.Context, req *CreateStyleGuardWordRequest) (*StyleGuardWord, error)
- func (s *StyleGuardClient) Delete(ctx context.Context, styleGuardID string) error
- func (s *StyleGuardClient) List(ctx context.Context) ([]StyleGuardWord, error)
- func (s *StyleGuardClient) ListForPersona(ctx context.Context, personaID string) ([]StyleGuardWord, error)
- func (s *StyleGuardClient) Update(ctx context.Context, styleGuardID string, req *UpdateStyleGuardWordRequest) (*StyleGuardWord, error)
- type StyleGuardWord
- type SuggestionAnchor
- type ToneCloneClient
- type TrainingClient
- func (t *TrainingClient) CreateJob(ctx context.Context, personaID string, fileIDs []string) (*TrainingJob, error)
- func (t *TrainingClient) CreatePersonaTrainingJob(ctx context.Context, personaID string) (*TrainingJob, error)
- func (t *TrainingClient) DeleteFile(ctx context.Context, fileID string) error
- func (t *TrainingClient) GetFile(ctx context.Context, fileID string) (*TrainingFile, error)
- func (t *TrainingClient) GetJob(ctx context.Context, jobID string) (*TrainingJob, error)
- func (t *TrainingClient) ListFiles(ctx context.Context) ([]TrainingFile, error)
- func (t *TrainingClient) ListJobs(ctx context.Context) ([]TrainingJob, error)
- func (t *TrainingClient) UploadFile(ctx context.Context, file io.Reader, filename string) (*TrainingFile, error)
- func (t *TrainingClient) UploadText(ctx context.Context, request *UploadTextRequest) (*TrainingFile, error)
- type TrainingFile
- type TrainingFileListResponse
- type TrainingJob
- type UpdateStyleGuardWordRequest
- type UploadTextRequest
- type User
- type WritingSession
- type WritingSessionListResponse
Constants ¶
const ( APIVersion = "v1" DefaultBaseURL = "https://api.toneclone.ai" DefaultTimeout = 30 * time.Second )
Constants for the API client
const KnowledgeSourceFileMaxBytes = 10 * 1024 * 1024
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIKey ¶
type APIKey struct {
KeyID string `json:"keyId"`
Name string `json:"name"`
Prefix string `json:"prefix"`
Scopes []APIKeyScope `json:"scopes"`
Status string `json:"status"`
CreatedAt time.Time `json:"createdAt"`
LastUsedAt *time.Time `json:"lastUsedAt,omitempty"`
ExpiresAt *time.Time `json:"expiresAt,omitempty"`
UsageCount int64 `json:"usageCount"`
}
APIKey represents an API key (for management)
type APIKeyListResponse ¶
type APIKeyListResponse struct {
Keys []APIKey `json:"keys"`
}
APIKeyListResponse represents the response from listing API keys
type APIKeyScope ¶
type APIKeyScope string
API Key Scope types
const ( // Read permissions ScopePersonasRead APIKeyScope = "personas:read" ScopeKnowledgeRead APIKeyScope = "knowledge:read" ScopeTrainingRead APIKeyScope = "training:read" ScopeFilesRead APIKeyScope = "files:read" ScopeWritingRead APIKeyScope = "writing:read" ScopeUserRead APIKeyScope = "user:read" // Write permissions ScopePersonasWrite APIKeyScope = "personas:write" ScopeKnowledgeWrite APIKeyScope = "knowledge:write" ScopeTrainingWrite APIKeyScope = "training:write" ScopeFilesWrite APIKeyScope = "files:write" ScopeWritingWrite APIKeyScope = "writing:write" ScopeUserWrite APIKeyScope = "user:write" // Text generation ScopeTextGenerate APIKeyScope = "text:generate" // Admin permissions ScopeAdmin APIKeyScope = "admin:all" // Wildcard permission ScopeAll APIKeyScope = "*" )
type APIResponse ¶
type APIResponse[T any] struct { Data T `json:"data,omitempty"` Error string `json:"error,omitempty"` Status int `json:"status,omitempty"` }
APIResponse represents a generic API response
type ApplyBundleRequest ¶ added in v1.1.0
type ApplyBundleRequest struct {
PersonaID string `json:"personaId,omitempty"`
BundleType string `json:"bundleType,omitempty"`
}
ApplyBundleRequest represents a request to apply a style guard bundle
type BundlePreviewItem ¶ added in v1.1.0
type BundlePreviewItem struct {
Word string `json:"word"`
Mode string `json:"mode"`
CustomReplacement string `json:"replacement,omitempty"`
Category string `json:"category,omitempty"`
}
BundlePreviewItem represents a single item in a bundle preview
type BundlePreviewResponse ¶ added in v1.1.2
type BundlePreviewResponse struct {
Version string `json:"version"`
Type string `json:"type"`
Items []BundlePreviewItem `json:"items"`
}
BundlePreviewResponse represents the API response for bundle preview
type BundleStatusResponse ¶ added in v1.1.0
type BundleStatusResponse struct {
Applied bool `json:"applied"`
Version string `json:"version,omitempty"`
Type string `json:"type,omitempty"`
WordsCount int `json:"wordsCount"`
ActiveCount int `json:"activeCount"`
}
BundleStatusResponse represents the status of a bundle application
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents the ToneClone API client
func NewClient ¶
func NewClient(apiKey string, options ...ClientOption) *Client
NewClient creates a new ToneClone API client
func (*Client) GetBaseURL ¶
GetBaseURL returns the configured base URL
func (*Client) GetUserAgent ¶
GetUserAgent returns the configured user agent
func (*Client) Patch ¶
func (c *Client) Patch(ctx context.Context, path string, body interface{}, result interface{}) error
Patch performs a PATCH request
func (*Client) PostMultipart ¶ added in v1.2.0
func (c *Client) PostMultipart(ctx context.Context, path, contentType string, body []byte, result interface{}) error
PostMultipart performs a POST request with a caller-provided multipart body.
func (*Client) SetTimeout ¶
SetTimeout updates the client timeout
func (*Client) ValidateAPIKey ¶
ValidateAPIKey validates that the API key is working
type ClientOption ¶
type ClientOption func(*Client)
ClientOption represents a configuration option for the client
func WithHTTPClient ¶
func WithHTTPClient(httpClient *http.Client) ClientOption
WithHTTPClient sets a custom HTTP client
func WithTimeout ¶
func WithTimeout(timeout time.Duration) ClientOption
WithTimeout sets a custom timeout
func WithUserAgent ¶
func WithUserAgent(userAgent string) ClientOption
WithUserAgent sets a custom user agent
type CreateStyleGuardWordRequest ¶ added in v1.1.0
type CreateStyleGuardWordRequest struct {
Word string `json:"word"`
PersonaID string `json:"personaId,omitempty"`
Mode string `json:"mode"`
CustomReplacement string `json:"customReplacement,omitempty"`
}
CreateStyleGuardWordRequest represents a request to create a style guard rule
type CritiqueClient ¶ added in v1.2.0
type CritiqueClient struct {
// contains filtered or unexported fields
}
CritiqueClient handles editorial feedback API operations.
func NewCritiqueClient ¶ added in v1.2.0
func NewCritiqueClient(client *Client) *CritiqueClient
func (*CritiqueClient) Get ¶ added in v1.2.0
func (c *CritiqueClient) Get(ctx context.Context, request *CritiqueRequest) (*CritiquePlan, error)
func (*CritiqueClient) History ¶ added in v1.2.0
func (c *CritiqueClient) History(ctx context.Context, sessionID string) (*CritiqueHistoryResponse, error)
type CritiqueHistoryResponse ¶ added in v1.2.0
type CritiqueHistoryResponse struct {
Items []CritiquePlan `json:"items"`
}
type CritiquePlan ¶ added in v1.2.0
type CritiquePlan struct {
CritiqueID string `json:"critiqueId,omitempty"`
SessionID string `json:"sessionId,omitempty"`
SourceVersionID string `json:"sourceVersionId,omitempty"`
DocumentHash string `json:"documentHash,omitempty"`
CreatedAt string `json:"createdAt,omitempty"`
StrategyNote string `json:"strategyNote"`
Suggestions []CritiqueSuggestion `json:"suggestions"`
}
type CritiqueRequest ¶ added in v1.2.0
type CritiqueRequest struct {
PersonaID string `json:"personaId"`
KnowledgeCardIDs []string `json:"knowledgeCardIds,omitempty"`
SessionID string `json:"sessionId,omitempty"`
SourceVersionID string `json:"sourceVersionId,omitempty"`
Document string `json:"document"`
Selection string `json:"selection,omitempty"`
SelectionStart *int `json:"selectionStart,omitempty"`
SelectionEnd *int `json:"selectionEnd,omitempty"`
Context string `json:"context,omitempty"`
Categories []string `json:"categories,omitempty"`
Intensity string `json:"intensity,omitempty"`
MaxSuggestions int `json:"maxSuggestions,omitempty"`
}
type CritiqueSuggestion ¶ added in v1.2.0
type CritiqueSuggestion struct {
ID string `json:"id"`
Type string `json:"type"`
Category string `json:"category"`
Priority int `json:"priority"`
Title string `json:"title"`
Rationale string `json:"rationale"`
Anchor *SuggestionAnchor `json:"anchor,omitempty"`
Replacement string `json:"replacement,omitempty"`
Instruction string `json:"instruction,omitempty"`
Scope string `json:"scope,omitempty"`
}
type DraftAngle ¶ added in v1.2.0
type DraftAngle struct {
Title string `json:"title"`
ShortLabel string `json:"shortLabel"`
Description string `json:"description"`
Approach string `json:"approach"`
VoiceEmphasis []string `json:"voiceEmphasis,omitempty"`
Avoid []string `json:"avoid,omitempty"`
}
DraftAngle describes one planned editorial angle for a draft variant.
type DraftAnglePlan ¶ added in v1.2.0
type DraftAnglePlan struct {
StrategyNote string `json:"strategyNote"`
Angles []DraftAngle `json:"angles"`
}
DraftAnglePlan is the editorial plan for a multi-draft request.
type DraftVariant ¶ added in v1.2.0
type DraftVariant struct {
Content string `json:"content"`
Temperature float64 `json:"temperature"`
Index int `json:"index"`
Angle *DraftAngle `json:"angle,omitempty"`
}
DraftVariant is a single draft from a multi-draft (n>1) generation.
type ErrorResponse ¶
type ErrorResponse struct {
ErrorMsg string `json:"error"`
Message string `json:"message,omitempty"`
Code string `json:"code,omitempty"`
}
ErrorResponse represents an API error response
func (ErrorResponse) Error ¶
func (e ErrorResponse) Error() string
type GenerateClient ¶
type GenerateClient struct {
// contains filtered or unexported fields
}
GenerateClient handles text generation API operations
func NewGenerateClient ¶
func NewGenerateClient(client *Client) *GenerateClient
NewGenerateClient creates a new generate client
func (*GenerateClient) Humanize ¶ added in v1.2.0
func (g *GenerateClient) Humanize(ctx context.Context, text, personaID string, createSession bool) (*GenerateTextResponse, error)
Humanize runs a StyleGuard-only pass over the given text (no model generation, no quota charge). Persona is optional; when provided, its StyleGuard config is used. If createSession is true, the response carries a reviewUrl.
func (*GenerateClient) SimpleText ¶
func (g *GenerateClient) SimpleText(ctx context.Context, prompt string, personaID ...string) (string, error)
SimpleText generates text with just a prompt and optional persona
func (*GenerateClient) Text ¶
func (g *GenerateClient) Text(ctx context.Context, request *GenerateTextRequest) (*GenerateTextResponse, error)
Text generates text using the specified parameters
func (*GenerateClient) TextVariants ¶ added in v1.2.0
func (g *GenerateClient) TextVariants(ctx context.Context, request *GenerateTextRequest) (*GenerateDraftsResponse, error)
TextVariants generates multiple draft variants (n 1..5) in a single non-streaming request. Each variant may carry a planned editorial angle when the backend produced an angle plan.
type GenerateDraftsResponse ¶ added in v1.2.0
type GenerateDraftsResponse struct {
Variants []DraftVariant `json:"variants"`
AnglePlan *DraftAnglePlan `json:"anglePlan,omitempty"`
SessionID string `json:"sessionId,omitempty"`
ReviewURL string `json:"reviewUrl,omitempty"`
}
GenerateDraftsResponse is the non-streaming multi-variant response envelope.
type GenerateTextRequest ¶
type GenerateTextRequest struct {
Prompt string `json:"prompt"`
PersonaID string `json:"personaId"`
Mode string `json:"mode,omitempty"`
Text string `json:"text,omitempty"`
KnowledgeCardID string `json:"knowledgeCardId,omitempty"`
KnowledgeCardIDs []string `json:"knowledgeCardIds,omitempty"`
Context string `json:"context,omitempty"`
SessionID string `json:"sessionId,omitempty"`
CreateSession bool `json:"createSession,omitempty"`
Document string `json:"document,omitempty"`
Selection string `json:"selection,omitempty"`
Formality int `json:"formality,omitempty"`
ReadingLevel int `json:"readingLevel,omitempty"`
Length int `json:"length,omitempty"`
Model string `json:"model,omitempty"`
N int `json:"n,omitempty"`
Streaming *bool `json:"streaming,omitempty"`
}
GenerateTextRequest represents a text generation request
type GenerateTextResponse ¶
type GenerateTextResponse struct {
Text string `json:"text"`
PersonaID string `json:"personaId,omitempty"`
KnowledgeCardID string `json:"knowledgeCardId,omitempty"`
Model string `json:"model,omitempty"`
Tokens int `json:"tokens,omitempty"`
SessionID string `json:"sessionId,omitempty"`
ReviewURL string `json:"reviewUrl,omitempty"`
}
GenerateTextResponse represents a text generation response
type ImperfectionSettings ¶ added in v1.1.0
type ImperfectionSettings struct {
Enabled bool `json:"enabled"`
Rate float64 `json:"rate"`
MaxPerChunk int `json:"maxPerChunk"`
ProtectedContexts []string `json:"protectedContexts,omitempty"`
}
ImperfectionSettings defines typo generation configuration
type KnowledgeCard ¶ added in v1.0.7
type KnowledgeCard struct {
PK string `json:"PK"`
SK string `json:"SK"`
KnowledgeCardID string `json:"knowledgeCardId"`
UserID string `json:"userId"`
Name string `json:"name"`
Instructions string `json:"instructions"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
}
KnowledgeCard represents a writing knowledge card
type KnowledgeCardIngestResponse ¶ added in v1.2.0
type KnowledgeCardIngestResponse struct {
KnowledgeCard KnowledgeCard `json:"knowledgeCard"`
Source KnowledgeCardSource `json:"source"`
Synthesis KnowledgeCardSynthesis `json:"synthesis,omitempty"`
}
type KnowledgeCardListResponse ¶ added in v1.0.7
type KnowledgeCardListResponse struct {
KnowledgeCards []KnowledgeCard `json:"knowledgeCards"`
}
KnowledgeCardListResponse represents the response from listing knowledge cards
type KnowledgeCardSource ¶ added in v1.2.0
type KnowledgeCardSource struct {
SourceID string `json:"sourceId"`
KnowledgeCardID string `json:"knowledgeCardId"`
UserID string `json:"userId,omitempty"`
Type string `json:"type"`
DisplayName string `json:"displayName"`
URL string `json:"url,omitempty"`
Filename string `json:"filename,omitempty"`
MimeType string `json:"mimeType,omitempty"`
Extension string `json:"extension,omitempty"`
SizeBytes int64 `json:"sizeBytes,omitempty"`
Status string `json:"status"`
ErrorMessage string `json:"errorMessage,omitempty"`
ExtractedTextPreview string `json:"extractedTextPreview,omitempty"`
ExtractedCharCount int `json:"extractedCharCount,omitempty"`
ContentHash string `json:"contentHash,omitempty"`
LastProcessedAt string `json:"lastProcessedAt,omitempty"`
CreatedAt string `json:"createdAt,omitempty"`
UpdatedAt string `json:"updatedAt,omitempty"`
}
type KnowledgeCardSynthesis ¶ added in v1.2.0
type KnowledgeCardSynthesis struct {
Name string `json:"name,omitempty"`
Instructions string `json:"instructions,omitempty"`
Summary string `json:"summary,omitempty"`
KeyFacts []string `json:"keyFacts,omitempty"`
UsageNotes []string `json:"usageNotes,omitempty"`
Warnings []string `json:"warnings,omitempty"`
}
type KnowledgeClient ¶ added in v1.0.7
type KnowledgeClient struct {
// contains filtered or unexported fields
}
KnowledgeClient handles knowledge-related API operations
func NewKnowledgeClient ¶ added in v1.0.7
func NewKnowledgeClient(client *Client) *KnowledgeClient
NewKnowledgeClient creates a new knowledge client
func (*KnowledgeClient) AssociateWithPersona ¶ added in v1.0.7
func (k *KnowledgeClient) AssociateWithPersona(ctx context.Context, knowledgeCardID, personaID string) error
AssociateWithPersona associates a knowledge card with a persona
func (*KnowledgeClient) Create ¶ added in v1.0.7
func (k *KnowledgeClient) Create(ctx context.Context, knowledge *KnowledgeCard) (*KnowledgeCard, error)
Create creates a new knowledge card
func (*KnowledgeClient) CreateFromFile ¶ added in v1.2.0
func (k *KnowledgeClient) CreateFromFile(ctx context.Context, filename string, content io.Reader, instructionsHint string) (*KnowledgeCardIngestResponse, error)
CreateFromFile creates a Knowledge Card from an uploaded document. filename should include the source extension so the backend can choose the extractor.
func (*KnowledgeClient) CreateFromURL ¶ added in v1.2.0
func (k *KnowledgeClient) CreateFromURL(ctx context.Context, rawURL, instructionsHint string) (*KnowledgeCardIngestResponse, error)
CreateFromURL creates a Knowledge Card by fetching and synthesizing durable instructions from a public HTTP(S) URL.
func (*KnowledgeClient) Delete ¶ added in v1.0.7
func (k *KnowledgeClient) Delete(ctx context.Context, knowledgeCardID string) error
Delete deletes a knowledge card
func (*KnowledgeClient) DisassociateFromPersona ¶ added in v1.0.7
func (k *KnowledgeClient) DisassociateFromPersona(ctx context.Context, knowledgeCardID, personaID string) error
DisassociateFromPersona disassociates a knowledge card from a persona
func (*KnowledgeClient) Get ¶ added in v1.0.7
func (k *KnowledgeClient) Get(ctx context.Context, knowledgeCardID string) (*KnowledgeCard, error)
Get retrieves a specific knowledge card by ID
func (*KnowledgeClient) GetPersonaKnowledge ¶ added in v1.0.7
func (k *KnowledgeClient) GetPersonaKnowledge(ctx context.Context, personaID string) ([]KnowledgeCard, error)
GetPersonaKnowledge retrieves all knowledge cards associated with a persona
func (*KnowledgeClient) List ¶ added in v1.0.7
func (k *KnowledgeClient) List(ctx context.Context) ([]KnowledgeCard, error)
List retrieves all knowledge cards for the authenticated user
func (*KnowledgeClient) Sources ¶ added in v1.2.0
func (k *KnowledgeClient) Sources(ctx context.Context, knowledgeCardID string) ([]KnowledgeCardSource, error)
Sources lists source provenance metadata for a Knowledge Card.
func (*KnowledgeClient) Update ¶ added in v1.0.7
func (k *KnowledgeClient) Update(ctx context.Context, knowledgeCardID string, knowledge *KnowledgeCard) (*KnowledgeCard, error)
Update updates an existing knowledge card
type ListOptions ¶
type ListOptions struct {
Limit int `json:"limit,omitempty"`
Offset int `json:"offset,omitempty"`
Sort string `json:"sort,omitempty"`
Filter string `json:"filter,omitempty"`
}
ListOptions represents common listing options
type PaginatedResponse ¶
type PaginatedResponse[T any] struct { Items []T `json:"items"` Total int `json:"total"` Limit int `json:"limit"` Offset int `json:"offset"` HasMore bool `json:"hasMore"` NextOffset int `json:"nextOffset,omitempty"` }
PaginatedResponse represents a paginated response
type Persona ¶
type Persona struct {
PersonaID string `json:"personaId"`
Name string `json:"name"`
LastUsedAt time.Time `json:"lastUsedAt"`
LastModifiedAt time.Time `json:"lastModifiedAt"`
Status string `json:"status"`
TrainingStatus string `json:"trainingStatus"`
PersonaType string `json:"personaType"`
VoiceEvolution bool `json:"voiceEvolution"`
PromptDescription string `json:"personaPromptDescription,omitempty"`
IsBuiltIn bool `json:"isBuiltIn,omitempty"`
Imperfections *ImperfectionSettings `json:"imperfections,omitempty"`
}
Persona represents a writing persona
type PersonaListResponse ¶
type PersonaListResponse struct {
Personas []Persona `json:"personas"`
}
PersonaListResponse represents the response from listing personas
type PersonasClient ¶
type PersonasClient struct {
// contains filtered or unexported fields
}
PersonasClient handles persona-related API operations
func NewPersonasClient ¶
func NewPersonasClient(client *Client) *PersonasClient
NewPersonasClient creates a new personas client
func (*PersonasClient) AssociateFiles ¶
func (p *PersonasClient) AssociateFiles(ctx context.Context, personaID string, fileIDs []string) error
AssociateFiles associates files with a persona
func (*PersonasClient) Delete ¶
func (p *PersonasClient) Delete(ctx context.Context, personaID string) error
Delete deletes a persona
func (*PersonasClient) DisassociateFiles ¶
func (p *PersonasClient) DisassociateFiles(ctx context.Context, personaID string, fileIDs []string) error
DisassociateFiles removes file associations from a persona
func (*PersonasClient) List ¶
func (p *PersonasClient) List(ctx context.Context) ([]Persona, error)
List retrieves all personas
func (*PersonasClient) ListBuiltIn ¶ added in v1.0.7
func (p *PersonasClient) ListBuiltIn(ctx context.Context) ([]Persona, error)
ListBuiltIn retrieves all built-in personas
func (*PersonasClient) ListFiles ¶
func (p *PersonasClient) ListFiles(ctx context.Context, personaID string) ([]TrainingFile, error)
ListFiles retrieves files associated with a persona
type Quota ¶ added in v1.2.0
type Quota struct {
PlanID string `json:"planId"`
PlanStatus string `json:"planStatus"`
Entitlements struct {
DraftsPerMonth int `json:"draftsPerMonth"`
CritiquePassesPerMonth int `json:"critiquePassesPerMonth"`
Personas int `json:"personas"`
KnowledgeCards int `json:"knowledgeCards"`
APIAccess bool `json:"apiAccess"`
} `json:"entitlements"`
CurrentUsage struct {
MonthlyDraftCount int `json:"monthlyDraftCount"`
MonthlyCritiqueCount int `json:"monthlyCritiqueCount"`
PersonaCount int `json:"personaCount"`
KnowledgeCardCount int `json:"knowledgeCardCount"`
} `json:"currentUsage"`
CanCreate struct {
Draft bool `json:"draft"`
Critique bool `json:"critique"`
Persona bool `json:"persona"`
KnowledgeCard bool `json:"knowledgeCard"`
} `json:"canCreate"`
UsagePeriod struct {
Start *time.Time `json:"start"`
End *time.Time `json:"end"`
} `json:"usagePeriod"`
}
Quota is the user's plan and usage snapshot from GET /user/plan-entitlements.
func (*Quota) CritiquePassesRemaining ¶ added in v1.2.0
CritiquePassesRemaining returns how many critique passes remain this period. A negative critiquePassesPerMonth entitlement (unlimited) returns -1.
func (*Quota) DraftsRemaining ¶ added in v1.2.0
DraftsRemaining returns how many drafts remain this period. A negative draftsPerMonth entitlement (unlimited) returns -1.
type RateLimitError ¶
type RateLimitError struct {
ErrorResponse
RemainingRequests int
ResetTime time.Time
RetryAfterSeconds int
}
RateLimitError represents a rate limiting error with retry information
func (*RateLimitError) Error ¶
func (e *RateLimitError) Error() string
type Recipe ¶ added in v1.2.0
type Recipe struct {
RecipeID string `json:"recipeId,omitempty"`
Command string `json:"command"`
Name string `json:"name"`
Description string `json:"description,omitempty"`
Instruction string `json:"instruction"`
AngleHints []string `json:"angleHints,omitempty"`
DefaultDraftCount int `json:"defaultDraftCount,omitempty"`
Source string `json:"source,omitempty"`
CreatedAt string `json:"createdAt,omitempty"`
UpdatedAt string `json:"updatedAt,omitempty"`
}
type RecipeRequest ¶ added in v1.2.0
type RecipeRequest struct {
Command string `json:"command"`
Name string `json:"name"`
Description string `json:"description,omitempty"`
Instruction string `json:"instruction"`
AngleHints []string `json:"angleHints,omitempty"`
DefaultDraftCount int `json:"defaultDraftCount,omitempty"`
UpdatedAt string `json:"updatedAt,omitempty"`
}
type RecipeSuggestionRequest ¶ added in v1.2.0
type RecipesClient ¶ added in v1.2.0
type RecipesClient struct {
// contains filtered or unexported fields
}
RecipesClient handles user recipe API operations.
func NewRecipesClient ¶ added in v1.2.0
func NewRecipesClient(client *Client) *RecipesClient
func (*RecipesClient) Create ¶ added in v1.2.0
func (r *RecipesClient) Create(ctx context.Context, request *RecipeRequest) (*Recipe, error)
func (*RecipesClient) List ¶ added in v1.2.0
func (r *RecipesClient) List(ctx context.Context) ([]Recipe, error)
func (*RecipesClient) Suggest ¶ added in v1.2.0
func (r *RecipesClient) Suggest(ctx context.Context, request *RecipeSuggestionRequest) (*Recipe, error)
func (*RecipesClient) Update ¶ added in v1.2.0
func (r *RecipesClient) Update(ctx context.Context, recipeID string, request *RecipeRequest) (*Recipe, error)
type StyleGuardClient ¶ added in v1.1.0
type StyleGuardClient struct {
// contains filtered or unexported fields
}
StyleGuardClient handles style guard API operations
func NewStyleGuardClient ¶ added in v1.1.0
func NewStyleGuardClient(client *Client) *StyleGuardClient
NewStyleGuardClient creates a new style guard client
func (*StyleGuardClient) BundleApply ¶ added in v1.1.0
func (s *StyleGuardClient) BundleApply(ctx context.Context, req *ApplyBundleRequest) error
BundleApply applies a style guard bundle
func (*StyleGuardClient) BundlePreview ¶ added in v1.1.0
func (s *StyleGuardClient) BundlePreview(ctx context.Context, bundleType string) (*BundlePreviewResponse, error)
BundlePreview previews items in a style guard bundle
func (*StyleGuardClient) BundleRemove ¶ added in v1.1.0
func (s *StyleGuardClient) BundleRemove(ctx context.Context, personaID string) error
BundleRemove removes bundle-sourced style guard rules
func (*StyleGuardClient) BundleStatus ¶ added in v1.1.0
func (s *StyleGuardClient) BundleStatus(ctx context.Context, personaID, bundleType string) (*BundleStatusResponse, error)
BundleStatus retrieves the bundle application status
func (*StyleGuardClient) Create ¶ added in v1.1.0
func (s *StyleGuardClient) Create(ctx context.Context, req *CreateStyleGuardWordRequest) (*StyleGuardWord, error)
Create creates a new style guard rule
func (*StyleGuardClient) Delete ¶ added in v1.1.0
func (s *StyleGuardClient) Delete(ctx context.Context, styleGuardID string) error
Delete deletes a style guard rule
func (*StyleGuardClient) List ¶ added in v1.1.0
func (s *StyleGuardClient) List(ctx context.Context) ([]StyleGuardWord, error)
List retrieves all global style guard rules
func (*StyleGuardClient) ListForPersona ¶ added in v1.1.0
func (s *StyleGuardClient) ListForPersona(ctx context.Context, personaID string) ([]StyleGuardWord, error)
ListForPersona retrieves style guard rules for a specific persona
func (*StyleGuardClient) Update ¶ added in v1.1.0
func (s *StyleGuardClient) Update(ctx context.Context, styleGuardID string, req *UpdateStyleGuardWordRequest) (*StyleGuardWord, error)
Update updates an existing style guard rule
type StyleGuardWord ¶ added in v1.1.0
type StyleGuardWord struct {
StyleGuardID string `json:"styleGuardId"`
Word string `json:"word"`
PersonaID string `json:"personaId,omitempty"`
Mode string `json:"mode"`
CustomReplacement string `json:"customReplacement,omitempty"`
Source string `json:"source,omitempty"`
BundleVersion string `json:"bundleVersion,omitempty"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
}
StyleGuardWord represents a style guard rule
type SuggestionAnchor ¶ added in v1.2.0
type ToneCloneClient ¶
type ToneCloneClient struct {
*Client
// Resource clients
Personas *PersonasClient
Generate *GenerateClient
Critique *CritiqueClient
Recipes *RecipesClient
Training *TrainingClient
Knowledge *KnowledgeClient
StyleGuard *StyleGuardClient
}
ToneCloneClient provides access to all ToneClone API resources
func NewToneCloneClient ¶
func NewToneCloneClient(apiKey string, options ...ClientOption) *ToneCloneClient
NewToneCloneClient creates a new ToneClone API client with all resource clients
func NewToneCloneClientFromConfig ¶
func NewToneCloneClientFromConfig(baseURL, apiKey string, timeout time.Duration) *ToneCloneClient
NewToneCloneClientFromConfig creates a client from configuration
func (*ToneCloneClient) GetQuota ¶ added in v1.2.0
func (tc *ToneCloneClient) GetQuota(ctx context.Context) (*Quota, error)
GetQuota fetches the user's current plan entitlements and usage.
func (*ToneCloneClient) Ping ¶
func (tc *ToneCloneClient) Ping(ctx context.Context) error
Ping tests the connection to the API
func (*ToneCloneClient) ValidateConnection ¶
func (tc *ToneCloneClient) ValidateConnection(ctx context.Context) error
ValidateConnection validates that the client can connect and authenticate
type TrainingClient ¶
type TrainingClient struct {
// contains filtered or unexported fields
}
TrainingClient handles training-related API operations
func NewTrainingClient ¶
func NewTrainingClient(client *Client) *TrainingClient
NewTrainingClient creates a new training client
func (*TrainingClient) CreateJob ¶
func (t *TrainingClient) CreateJob(ctx context.Context, personaID string, fileIDs []string) (*TrainingJob, error)
CreateJob creates a new training job
func (*TrainingClient) CreatePersonaTrainingJob ¶
func (t *TrainingClient) CreatePersonaTrainingJob(ctx context.Context, personaID string) (*TrainingJob, error)
CreatePersonaTrainingJob creates a training job for a persona using all associated files
func (*TrainingClient) DeleteFile ¶
func (t *TrainingClient) DeleteFile(ctx context.Context, fileID string) error
DeleteFile deletes a training file
func (*TrainingClient) GetFile ¶
func (t *TrainingClient) GetFile(ctx context.Context, fileID string) (*TrainingFile, error)
GetFile retrieves a specific training file by ID
func (*TrainingClient) GetJob ¶
func (t *TrainingClient) GetJob(ctx context.Context, jobID string) (*TrainingJob, error)
GetJob retrieves a specific training job by ID
func (*TrainingClient) ListFiles ¶
func (t *TrainingClient) ListFiles(ctx context.Context) ([]TrainingFile, error)
ListFiles retrieves all training files for the user
func (*TrainingClient) ListJobs ¶
func (t *TrainingClient) ListJobs(ctx context.Context) ([]TrainingJob, error)
ListJobs retrieves all training jobs for the user
func (*TrainingClient) UploadFile ¶
func (t *TrainingClient) UploadFile(ctx context.Context, file io.Reader, filename string) (*TrainingFile, error)
UploadFile uploads a binary file
func (*TrainingClient) UploadText ¶
func (t *TrainingClient) UploadText(ctx context.Context, request *UploadTextRequest) (*TrainingFile, error)
UploadText uploads text content
type TrainingFile ¶
type TrainingFile struct {
PK string `json:"PK"`
SK string `json:"SK"`
UserID string `json:"userId"`
FileID string `json:"fileId"`
FileName string `json:"filename"`
FileType string `json:"fileType"`
FileSize int64 `json:"size"`
CreatedAt time.Time `json:"createdAt"`
ModifiedAt time.Time `json:"modifiedAt"`
S3Key string `json:"s3Key"`
ContentType string `json:"contentType"`
Source string `json:"source"`
UsedForTraining bool `json:"usedForTraining"`
PersonaID string `json:"personaId,omitempty"`
}
TrainingFile represents a training file
type TrainingFileListResponse ¶
type TrainingFileListResponse struct {
Files []TrainingFile `json:"files"`
}
TrainingFileListResponse represents the response from listing training files
type TrainingJob ¶
type TrainingJob struct {
JobID string `json:"jobId"`
PersonaID string `json:"personaId"`
FileIDs []string `json:"fileIds"`
TotalFiles int `json:"totalFiles"`
FilesProcessed int `json:"filesProcessed"`
Status string `json:"status"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
OpenAIJobID string `json:"openAIJobID,omitempty"`
OpenAIJobStatus string `json:"openAIJobStatus,omitempty"`
BaseModel string `json:"baseModel,omitempty"`
}
TrainingJob represents a training job
type UpdateStyleGuardWordRequest ¶ added in v1.1.0
type UpdateStyleGuardWordRequest struct {
Word string `json:"word,omitempty"`
Mode string `json:"mode,omitempty"`
CustomReplacement string `json:"customReplacement,omitempty"`
}
UpdateStyleGuardWordRequest represents a request to update a style guard rule
type UploadTextRequest ¶
type UploadTextRequest struct {
Content string `json:"content"`
Filename string `json:"filename"`
Source string `json:"source"`
}
UploadTextRequest represents a text upload request
type User ¶
type User struct {
UserID string `json:"userId"`
Email string `json:"email"`
Name string `json:"name,omitempty"`
CreatedAt time.Time `json:"createdAt"`
Plan string `json:"plan,omitempty"`
}
User represents user information
type WritingSession ¶
type WritingSession struct {
SessionID string `json:"sessionId"`
Title string `json:"title,omitempty"`
Content string `json:"content,omitempty"`
PersonaID string `json:"personaId,omitempty"`
KnowledgeCardID string `json:"knowledgeCardId,omitempty"`
CreatedAt time.Time `json:"createdAt"`
LastModifiedAt time.Time `json:"lastModifiedAt"`
Status string `json:"status"`
}
WritingSession represents a writing session
type WritingSessionListResponse ¶
type WritingSessionListResponse struct {
Sessions []WritingSession `json:"sessions"`
}
WritingSessionListResponse represents the response from listing writing sessions