DocsAPI reference

Class@astack-tech/integrations

OpenAICompatible

Defined in: packages/integrations/src/model-provider/openai-compatible/index.ts:257

Model provider for any API that speaks the OpenAI chat completions protocol: OpenAI itself, and the compatible endpoints of DeepSeek, Qwen, Moonshot, Ollama, vLLM and others. Set baseURL and model for the provider you use.

Ports:

  • prompt (in): a text prompt. The answer is sent on completion.
  • messages (in): a list of chat messages. The reply is sent on message.

Extends

  • Component

Extended by

Constructors

Constructor

TypeScript
new OpenAICompatible(config): OpenAICompatible;

Defined in: packages/integrations/src/model-provider/openai-compatible/index.ts:268

Parameters

Parameter Type
config OpenAICompatibleConfig

Returns

OpenAICompatible

Overrides

Component.constructor

Properties

Property Modifier Type Description Inherited from Defined in
flow public Flow | null - Deepseek.flow node_modules/.pnpm/@hlang-org+runtime@1.0.7/node_modules/@hlang-org/runtime/lib/node/node.d.ts:24
I public (name) => Port - Component.I node_modules/.pnpm/@hlang-org+runtime@1.0.7/node_modules/@hlang-org/runtime/lib/node/node.d.ts:26
id public string - Component.id node_modules/.pnpm/@hlang-org+runtime@1.0.7/node_modules/@hlang-org/runtime/lib/node/node.d.ts:18
identity public Symbol - Component.identity node_modules/.pnpm/@hlang-org+runtime@1.0.7/node_modules/@hlang-org/runtime/lib/node/node.d.ts:25
inPort protected readonly Port The default in input port. Component.inPort packages/core/dist/component/index.d.ts:49
isRunning public boolean - Component.isRunning node_modules/.pnpm/@hlang-org+runtime@1.0.7/node_modules/@hlang-org/runtime/lib/node/node.d.ts:23
O public (name) => Port - Component.O node_modules/.pnpm/@hlang-org+runtime@1.0.7/node_modules/@hlang-org/runtime/lib/node/node.d.ts:27
opts public object - Component.opts node_modules/.pnpm/@hlang-org+runtime@1.0.7/node_modules/@hlang-org/runtime/lib/node/node.d.ts:19
outPort protected readonly Port The default out output port. A pipeline uses it to infer the endpoint. Component.outPort packages/core/dist/component/index.d.ts:51
portMap public PortMap - Component.portMap node_modules/.pnpm/@hlang-org+runtime@1.0.7/node_modules/@hlang-org/runtime/lib/node/node.d.ts:22
type public Symbol - Component.type node_modules/.pnpm/@hlang-org+runtime@1.0.7/node_modules/@hlang-org/runtime/lib/node/node.d.ts:17
Port static typeof Port Port factory from the HLang runtime. Component.Port.I(name) and Component.Port.O(name) create input and output ports; call .attach(this) in the constructor. Component.Port packages/core/dist/component/index.d.ts:47

Methods

_transform()

TypeScript
_transform($i, $o): void;

Defined in: packages/integrations/src/model-provider/openai-compatible/index.ts:414

Connects the prompt and messages input ports to the model. API errors produce a fallback value so the pipeline keeps flowing.

Parameters

Parameter Type
$i Port
$o Port

Returns

void

Overrides

Component._transform


attach()

TypeScript
attach(flow): void;

Defined in: node_modules/.pnpm/@hlang-org+runtime@1.0.7/node_modules/@hlang-org/runtime/lib/node/node.d.ts:31

Parameters

Parameter Type
flow any

Returns

void

Inherited from

Component.attach


attachPort()

TypeScript
attachPort(port): void;

Defined in: node_modules/.pnpm/@hlang-org+runtime@1.0.7/node_modules/@hlang-org/runtime/lib/node/node.d.ts:32

Parameters

Parameter Type
port any

Returns

void

Inherited from

Component.attachPort


chatCompletion()

TypeScript
chatCompletion(messages, options?): Promise<DeepseekAssistantMessage>;

Defined in: packages/integrations/src/model-provider/openai-compatible/index.ts:317

Sends a conversation and returns the assistant reply.

Parameters

Parameter Type
messages DeepseekMessage[]
options? DeepseekChatCompletionOptions

Returns

Promise<DeepseekAssistantMessage>


E()

TypeScript
E(): Port;

Defined in: node_modules/.pnpm/@hlang-org+runtime@1.0.7/node_modules/@hlang-org/runtime/lib/node/node.d.ts:30

Returns

Port

Inherited from

Component.E


executeOnce()

TypeScript
executeOnce(type, ...args): void;

Defined in: node_modules/.pnpm/@hlang-org+runtime@1.0.7/node_modules/@hlang-org/runtime/lib/node/node.d.ts:29

Parameters

Parameter Type
type any
...args any[]

Returns

void

Inherited from

Component.executeOnce


generateCompletion()

TypeScript
generateCompletion(prompt): Promise<string>;

Defined in: packages/integrations/src/model-provider/openai-compatible/index.ts:300

Generates a completion for a single prompt.

Parameters

Parameter Type
prompt string

Returns

Promise<string>

The text answer, or the JSON-encoded assistant message when it contains tool calls.


run()

TypeScript
run(input): Promise<
  | string
| DeepseekAssistantMessage>;

Defined in: packages/integrations/src/model-provider/openai-compatible/index.ts:406

Runs the model outside a pipeline.

Parameters

Parameter Type Description
input string | DeepseekMessage[] A prompt string or a list of messages.

Returns

Promise< | string | DeepseekAssistantMessage>

Overrides

Component.run


streamChatCompletion()

TypeScript
streamChatCompletion(messages, options?): AsyncGenerator<DeepseekStreamChunk>;

Defined in: packages/integrations/src/model-provider/openai-compatible/index.ts:359

Streams the assistant reply. Each chunk holds a text delta, tool-call deltas, or usage.

Parameters

Parameter Type
messages DeepseekMessage[]
options? DeepseekChatCompletionOptions

Returns

AsyncGenerator<DeepseekStreamChunk>


throw()

TypeScript
throw(error): void;

Defined in: node_modules/.pnpm/@hlang-org+runtime@1.0.7/node_modules/@hlang-org/runtime/lib/node/transform.d.ts:4

Parameters

Parameter Type
error any

Returns

void

Inherited from

Component.throw