const openApiKey = Config.redacted('OPENAI_API_KEY');
const x = Effect.gen(function*(_) {
const apiKey = yield* openApiKey;
const ClientLive = OpenAiClient.layer({
apiKey,
transformClient: HttpClient.retryTransient({
schedule: Schedule.spaced('1 second'),
}),
}).pipe(Layer.provide(FetchHttpClient.layer));
const CompletionsLive = OpenAiCompletions.layer({ model: 'gpt-4o' }).pipe(
Layer.provide(ClientLive),
);
return CompletionsLive;
});
Layer.provideMerge(MessageClassification.Default) // How to provide the layer created on X to this?
export const Runtime = ManagedRuntime.make(Logger.pretty); // How to put it here so it can run any effect that uses my service?
const openApiKey = Config.redacted('OPENAI_API_KEY');
const x = Effect.gen(function*(_) {
const apiKey = yield* openApiKey;
const ClientLive = OpenAiClient.layer({
apiKey,
transformClient: HttpClient.retryTransient({
schedule: Schedule.spaced('1 second'),
}),
}).pipe(Layer.provide(FetchHttpClient.layer));
const CompletionsLive = OpenAiCompletions.layer({ model: 'gpt-4o' }).pipe(
Layer.provide(ClientLive),
);
return CompletionsLive;
});
Layer.provideMerge(MessageClassification.Default) // How to provide the layer created on X to this?
export const Runtime = ManagedRuntime.make(Logger.pretty); // How to put it here so it can run any effect that uses my service?