Skip to main content

Built and signed on GitHub Actions

environment wrapper, supports all JS environment including node, deno, bun, edge runtime, and cloudflare worker

This package works with Cloudflare Workers, Node.js, Deno, Bun
This package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Bun
JSR Score
82%
Published
4 months ago (0.1.3)
function setEnvs
setEnvs(envs: object): void

Set environment variables before using llamaindex, because some LLM need to access API key before running.

You have to set the environment variables in Cloudflare Worker environment, because it doesn't have any global environment variables.

Examples

Example 1

export default {
  async fetch(
    request: Request,
    env: Env,
    ctx: ExecutionContext,
  ): Promise<Response> {
    const { setEnvs } = await import("@llamaindex/env");
    setEnvs(env);
    // ...
    return new Response("Hello, World!");
  },
};

Parameters

envs: object

Environment variables

Return Type

void

Add Package

deno add @llamaindex/env

Import symbol

import { setEnvs } from "@llamaindex/env";

Add Package

npx jsr add @llamaindex/env

Import symbol

import { setEnvs } from "@llamaindex/env";

Add Package

yarn dlx jsr add @llamaindex/env

Import symbol

import { setEnvs } from "@llamaindex/env";

Add Package

pnpm dlx jsr add @llamaindex/env

Import symbol

import { setEnvs } from "@llamaindex/env";

Add Package

bunx jsr add @llamaindex/env

Import symbol

import { setEnvs } from "@llamaindex/env";