1import * as Neon from "alchemy/Neon";
2import * as Config from "effect/Config";
3import * as Effect from "effect/Effect";
4import { resources } from "../resources.ts";
5import EffectApi from "./EffectApi.ts";
6import { gateway } from "./resources.ts";
7
8export const ai = Effect.gen(function* () {
9 const { branch } = yield* resources;
10 const backend = yield* gateway;
11 const native = yield* Neon.Function("NativeAI", {
12 branch,
13 main: "./src/ai/native.ts",
14 env: {
15 EXAMPLE_API_KEY: yield* Config.Redacted("NEON_EXAMPLE_API_KEY"),
16 AI_MODEL: yield* Config.String("NEON_AI_MODEL"),
17 AI_ALLOW_PAID: yield* Config.String("NEON_AI_ALLOW_PAID").pipe(
18 Config.withDefault("false"),
19 ),
20 },
21 });
22 const effect = yield* EffectApi;
23 return {
24 nativeUrl: native.url,
25 effectUrl: effect.url,
26 gatewayUrl: backend.baseUrl,
27 };
28});