mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-07-01 17:39:39 +02:00
Use native runtimes for flow entrypoints
This commit is contained in:
parent
54fc21b38d
commit
74955d6041
38 changed files with 233 additions and 134 deletions
|
|
@ -9,6 +9,7 @@
|
|||
*/
|
||||
|
||||
import { AzureOpenAI } from "openai";
|
||||
import { NodeRuntime } from "@effect/platform-node";
|
||||
import {
|
||||
Llm,
|
||||
makeLlmService,
|
||||
|
|
@ -20,7 +21,7 @@ import {
|
|||
type LlmResult,
|
||||
type LlmChunk,
|
||||
} from "@trustgraph/base";
|
||||
import { Effect, Layer, Stream } from "effect";
|
||||
import { Effect, Layer, ManagedRuntime, Stream } from "effect";
|
||||
import {
|
||||
optionalStringConfig,
|
||||
providerStatusError,
|
||||
|
|
@ -229,6 +230,12 @@ export const program = makeFlowProcessorProgram<ProcessorConfig, never, Llm>({
|
|||
),
|
||||
});
|
||||
|
||||
const azureOpenAITextCompletionRuntime = ManagedRuntime.make(Layer.empty);
|
||||
|
||||
export function run(): Promise<void> {
|
||||
return Effect.runPromise(program);
|
||||
return azureOpenAITextCompletionRuntime.runPromise(program);
|
||||
}
|
||||
|
||||
export function runMain(): void {
|
||||
NodeRuntime.runMain(program);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
*/
|
||||
|
||||
import Anthropic from "@anthropic-ai/sdk";
|
||||
import { NodeRuntime } from "@effect/platform-node";
|
||||
import {
|
||||
Llm,
|
||||
makeLlmService,
|
||||
|
|
@ -16,7 +17,7 @@ import {
|
|||
type LlmResult,
|
||||
type LlmChunk,
|
||||
} from "@trustgraph/base";
|
||||
import { Effect, Layer, Stream } from "effect";
|
||||
import { Effect, Layer, ManagedRuntime, Stream } from "effect";
|
||||
import {
|
||||
optionalStringConfig,
|
||||
providerStatusError,
|
||||
|
|
@ -209,6 +210,12 @@ export const program = makeFlowProcessorProgram<ProcessorConfig, never, Llm>({
|
|||
),
|
||||
});
|
||||
|
||||
const claudeTextCompletionRuntime = ManagedRuntime.make(Layer.empty);
|
||||
|
||||
export function run(): Promise<void> {
|
||||
return Effect.runPromise(program);
|
||||
return claudeTextCompletionRuntime.runPromise(program);
|
||||
}
|
||||
|
||||
export function runMain(): void {
|
||||
NodeRuntime.runMain(program);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
*/
|
||||
|
||||
import { Mistral } from "@mistralai/mistralai";
|
||||
import { NodeRuntime } from "@effect/platform-node";
|
||||
import {
|
||||
Llm,
|
||||
makeLlmService,
|
||||
|
|
@ -18,7 +19,7 @@ import {
|
|||
type LlmResult,
|
||||
type LlmChunk,
|
||||
} from "@trustgraph/base";
|
||||
import { Effect, Layer, Stream } from "effect";
|
||||
import { Effect, Layer, ManagedRuntime, Stream } from "effect";
|
||||
import {
|
||||
optionalStringConfig,
|
||||
providerStatusError,
|
||||
|
|
@ -208,6 +209,12 @@ export const program = makeFlowProcessorProgram<ProcessorConfig, never, Llm>({
|
|||
),
|
||||
});
|
||||
|
||||
const mistralTextCompletionRuntime = ManagedRuntime.make(Layer.empty);
|
||||
|
||||
export function run(): Promise<void> {
|
||||
return Effect.runPromise(program);
|
||||
return mistralTextCompletionRuntime.runPromise(program);
|
||||
}
|
||||
|
||||
export function runMain(): void {
|
||||
NodeRuntime.runMain(program);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
*/
|
||||
|
||||
import { Ollama } from "ollama";
|
||||
import { NodeRuntime } from "@effect/platform-node";
|
||||
import {
|
||||
Llm,
|
||||
makeLlmService,
|
||||
|
|
@ -18,7 +19,7 @@ import {
|
|||
type LlmResult,
|
||||
type LlmChunk,
|
||||
} from "@trustgraph/base";
|
||||
import { Effect, Layer, Stream } from "effect";
|
||||
import { Effect, Layer, ManagedRuntime, Stream } from "effect";
|
||||
import {
|
||||
optionalStringConfig,
|
||||
providerRuntimeError,
|
||||
|
|
@ -187,6 +188,12 @@ export const program = makeFlowProcessorProgram<ProcessorConfig, never, Llm>({
|
|||
),
|
||||
});
|
||||
|
||||
const ollamaTextCompletionRuntime = ManagedRuntime.make(Layer.empty);
|
||||
|
||||
export function run(): Promise<void> {
|
||||
return Effect.runPromise(program);
|
||||
return ollamaTextCompletionRuntime.runPromise(program);
|
||||
}
|
||||
|
||||
export function runMain(): void {
|
||||
NodeRuntime.runMain(program);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
*/
|
||||
|
||||
import OpenAI from "openai";
|
||||
import { NodeRuntime } from "@effect/platform-node";
|
||||
import {
|
||||
Llm,
|
||||
makeLlmService,
|
||||
|
|
@ -21,7 +22,7 @@ import {
|
|||
type LlmResult,
|
||||
type LlmChunk,
|
||||
} from "@trustgraph/base";
|
||||
import { Effect, Layer, Stream } from "effect";
|
||||
import { Effect, Layer, ManagedRuntime, Stream } from "effect";
|
||||
import {
|
||||
optionalStringConfig,
|
||||
providerStatusError,
|
||||
|
|
@ -220,6 +221,12 @@ export const program = makeFlowProcessorProgram<ProcessorConfig, never, Llm>({
|
|||
),
|
||||
});
|
||||
|
||||
const openAICompatibleTextCompletionRuntime = ManagedRuntime.make(Layer.empty);
|
||||
|
||||
export function run(): Promise<void> {
|
||||
return Effect.runPromise(program);
|
||||
return openAICompatibleTextCompletionRuntime.runPromise(program);
|
||||
}
|
||||
|
||||
export function runMain(): void {
|
||||
NodeRuntime.runMain(program);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
*/
|
||||
|
||||
import OpenAI from "openai";
|
||||
import { NodeRuntime } from "@effect/platform-node";
|
||||
import {
|
||||
Llm,
|
||||
makeLlmService,
|
||||
|
|
@ -16,7 +17,7 @@ import {
|
|||
type LlmResult,
|
||||
type LlmChunk,
|
||||
} from "@trustgraph/base";
|
||||
import { Effect, Layer, Stream } from "effect";
|
||||
import { Effect, Layer, ManagedRuntime, Stream } from "effect";
|
||||
import {
|
||||
optionalStringConfig,
|
||||
providerStatusError,
|
||||
|
|
@ -211,6 +212,12 @@ export const program = makeFlowProcessorProgram<ProcessorConfig, never, Llm>({
|
|||
),
|
||||
});
|
||||
|
||||
const openAITextCompletionRuntime = ManagedRuntime.make(Layer.empty);
|
||||
|
||||
export function run(): Promise<void> {
|
||||
return Effect.runPromise(program);
|
||||
return openAITextCompletionRuntime.runPromise(program);
|
||||
}
|
||||
|
||||
export function runMain(): void {
|
||||
NodeRuntime.runMain(program);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue