Captain is currently in ALPHA. We are happy to get your feedback
Core API
Helpers Ipc Sdk Assistant

Module: helpers/ipc/sdk/assistant

Table of contents

Variables

Functions

Variables

PATH_PLACEHOLDER

Const PATH_PLACEHOLDER: "c:/users/anon/"

Defined in

src/electron/helpers/ipc/sdk/assistant.ts:42 (opens in a new tab)


STORE_CATEGORIES

Const STORE_CATEGORIES: readonly ["image", "story", "app"]

Defined in

src/electron/helpers/ipc/sdk/assistant.ts:349 (opens in a new tab)


assistantStore

Const assistantStore: default<Record<string, ChatModel>>

Defined in

src/electron/helpers/ipc/sdk/assistant.ts:38 (opens in a new tab)

Functions

chatCompletion

chatCompletion(«destructured»): Promise<string>

Parameters

NameType
«destructured»Object
› messagesCoreMessage[]
› modelLanguageModelV1
› systemundefined | string
› onStep?(_partialResponse: string) => void

Returns

Promise<string>

Defined in

src/electron/helpers/ipc/sdk/assistant.ts:221 (opens in a new tab)


createChatLabelPrompt

createChatLabelPrompt(): string

Returns

string

Defined in

src/electron/helpers/ipc/sdk/assistant.ts:67 (opens in a new tab)


createSystemPrompt

createSystemPrompt(«destructured»): string

Parameters

NameType
«destructured»Object
› modelstring
› providerstring

Returns

string

Defined in

src/electron/helpers/ipc/sdk/assistant.ts:71 (opens in a new tab)


createSystemPrompt2

createSystemPrompt2(«destructured»): string

Parameters

NameType
«destructured»Object
› modelstring
› providerstring

Returns

string

Defined in

src/electron/helpers/ipc/sdk/assistant.ts:156 (opens in a new tab)


createVectorSearchPrompt

createVectorSearchPrompt(«destructured»): string

Parameters

NameType
«destructured»Object
› dataTypesstring[]

Returns

string

Defined in

src/electron/helpers/ipc/sdk/assistant.ts:63 (opens in a new tab)


createWorkflow

createWorkflow(«destructured»): NodeChain

Parameters

NameTypeDefault value
«destructured»Objectundefined
› cfg?number7
› checkpointName?stringundefined
› heightnumberundefined
› loraName?stringundefined
› loraWeight?number1
› negativePrompt?string""
› prompt?string""
› seed?number1234
› steps?number20
› widthnumberundefined

Returns

NodeChain

Defined in

src/electron/helpers/ipc/sdk/assistant.ts:249 (opens in a new tab)


cropCaptainData

cropCaptainData(filePath): string

Parameters

NameType
filePathstring

Returns

string

Defined in

src/electron/helpers/ipc/sdk/assistant.ts:44 (opens in a new tab)


cropIncompleteImageTag

cropIncompleteImageTag(markdown): string

Parameters

NameType
markdownstring

Returns

string

Defined in

src/electron/helpers/ipc/sdk/assistant.ts:351 (opens in a new tab)


extendCaptainData

extendCaptainData(content): string

Parameters

NameType
contentstring

Returns

string

Defined in

src/electron/helpers/ipc/sdk/assistant.ts:49 (opens in a new tab)


getAssistant

getAssistant(model): null | OpenAIProvider | AnthropicProvider | MistralProvider | GoogleGenerativeAIProvider

Parameters

NameType
modelstring

Returns

null | OpenAIProvider | AnthropicProvider | MistralProvider | GoogleGenerativeAIProvider

Defined in

src/electron/helpers/ipc/sdk/assistant.ts:586 (opens in a new tab)


getProvider

getProvider(model): "Anthropic" | "Mistral" | "Google" | "Open AI" | "Unknown"

Parameters

NameType
modelstring

Returns

"Anthropic" | "Mistral" | "Google" | "Open AI" | "Unknown"

Defined in

src/electron/helpers/ipc/sdk/assistant.ts:617 (opens in a new tab)


replaceCaptainData

replaceCaptainData(content): string

Parameters

NameType
contentstring

Returns

string

Defined in

src/electron/helpers/ipc/sdk/assistant.ts:56 (opens in a new tab)


streamWithTools

streamWithTools<TOOLS>(assistant, «destructured»): Promise<string>

Type parameters

NameType
TOOLSextends Record<string, CoreTool<any, any>>

Parameters

NameType
assistantOpenAIProvider | AnthropicProvider | MistralProvider | GoogleGenerativeAIProvider
«destructured»Object
› historyCoreMessage[]
› modelstring
› toolsTOOLS
› onStream(response: string) => void

Returns

Promise<string>

Defined in

src/electron/helpers/ipc/sdk/assistant.ts:642 (opens in a new tab)


tools

tools(appId, send?): Object

Parameters

NameType
appIdstring
send?<T>(action: string, payload: T) => void

Returns

Object

NameType
textToImageCoreTool<ZodObject<{ dimensions: ZodDefault<ZodObject<{ height: ZodNumber ; width: ZodNumber }, "strip", ZodTypeAny, { height: number ; width: number }, { height: number ; width: number }>> ; prompt: ZodString ; seed: ZodDefault<ZodNumber> }, "strip", ZodTypeAny, { dimensions: { height: number ; width: number } ; prompt: string ; seed: number }, { dimensions: undefined | { height: number ; width: number } ; prompt: string ; seed: undefined | number }>, { error: string ; filePath?: undefined ; height: undefined ; prompt: undefined ; seed: undefined ; width: undefined } | { error?: undefined = message; filePath: string ; height: number ; prompt: string ; seed: number ; width: number }> & {}
vectorSearchCoreTool<ZodObject<{ categories: ZodArray<ZodEnum<["image", "story", "app"]>, "many"> ; query: ZodString }, "strip", ZodTypeAny, { categories: ("app" | "image" | "story")[] ; query: string }, { categories: ("app" | "image" | "story")[] ; query: string }>, { error?: undefined = message; matches: ({ filePath: unknown } | { filePath: unknown } | { filePath: unknown } | { filePath: unknown })[] } | { error: string = message; matches?: undefined }> & {}

Defined in

src/electron/helpers/ipc/sdk/assistant.ts:380 (opens in a new tab)