Skip to content

Commit

Permalink
chore: small update for cf example
Browse files Browse the repository at this point in the history
  • Loading branch information
ytkimirti committed Oct 2, 2024
1 parent f8277e0 commit 49668c6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
8 changes: 3 additions & 5 deletions examples/cloudflare-workers/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ The project includes four endpoints:
- `/add-data` to add data to your endpoint.
- `/chat` to make a chat request with rag-chat using Upstash LLM.
- `/chat-stream` to make a chat request with rag-chat using Upstash LLM with streaming.
- `/chat-stream-openai` to make a chat request with rag-chat using OpenAI LLM with streaming.

You can check out the `src/index.ts` file to see how each endpoint works.

Expand All @@ -30,7 +29,7 @@ npm install @upstash/rag-chat
Ensure your wrangler.toml file includes the following configuration to enable Node.js compatibility:

```toml
compatibility_flags = ["nodejs_compat_v2"]
compatibility_flags = ["nodejs_compat"]
```

In older CF worker versions, you may need to set the following compatibility flags:
Expand All @@ -49,11 +48,10 @@ UPSTASH_REDIS_REST_TOKEN="***"
UPSTASH_VECTOR_REST_URL="***"
UPSTASH_VECTOR_REST_TOKEN="***"
QSTASH_TOKEN="***"
OPENAI_API_KEY="***"
```

- `QSTASH_TOKEN` is needed for the `/chat` and `/chat-stream` endpoints.
- `OPENAI_API_KEY` is needed for the `/chat-stream-openai` endpoint.
`QSTASH_TOKEN` is needed for the `/chat` and `/chat-stream` endpoints. If you want to use the openai models for the llm,
you can provide the `OPENAI_API_KEY` environment variable instead.

For deployment, use the `wrangler` CLI to securely set environment variables.
Run the following command for each secret:
Expand Down
2 changes: 1 addition & 1 deletion examples/cloudflare-workers/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Hono } from "hono";
import { Index } from "@upstash/vector";
import { openai, RAGChat, upstash } from "@upstash/rag-chat";
import { RAGChat, upstash } from "@upstash/rag-chat";

const app = new Hono<{
Variables: {
Expand Down

0 comments on commit 49668c6

Please sign in to comment.