Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
LlamaIndexTS
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mirrored_repos
MachineLearning
run-llama
LlamaIndexTS
Commits
7467fce2
Unverified
Commit
7467fce2
authored
8 months ago
by
Alex Yang
Committed by
GitHub
8 months ago
Browse files
Options
Downloads
Patches
Plain Diff
docs: remove cloudflare worker section (#1000)
parent
06af08ca
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
README.md
+1
-35
1 addition, 35 deletions
README.md
with
1 addition
and
35 deletions
README.md
+
1
−
35
View file @
7467fce2
...
...
@@ -76,7 +76,7 @@ main();
node
--import
tsx ./main.ts
```
###
Next.js
###
React Server Component (Next.js, Waku, Redwood.JS...)
First, you will need to add a llamaindex plugin to your Next.js project.
...
...
@@ -154,40 +154,6 @@ export async function chatWithAgent(
}
```
### Cloudflare Workers
```
ts
// src/index.ts
export
default
{
async
fetch
(
request
:
Request
,
env
:
Env
,
ctx
:
ExecutionContext
,
):
Promise
<
Response
>
{
const
{
setEnvs
}
=
await
import
(
"
@llamaindex/env
"
);
// set environment variables so that the OpenAIAgent can use them
setEnvs
(
env
);
const
{
OpenAIAgent
}
=
await
import
(
"
llamaindex
"
);
const
agent
=
new
OpenAIAgent
({
tools
:
[],
});
const
responseStream
=
await
agent
.
chat
({
stream
:
true
,
message
:
"
Hello? What is the weather today?
"
,
});
const
textEncoder
=
new
TextEncoder
();
const
response
=
responseStream
.
pipeThrough
(
new
TransformStream
({
transform
:
(
chunk
,
controller
)
=>
{
controller
.
enqueue
(
textEncoder
.
encode
(
chunk
.
response
.
delta
));
},
}),
);
return
new
Response
(
response
);
},
};
```
## Playground
Check out our NextJS playground at https://llama-playground.vercel.app/. The source is available at https://github.com/run-llama/ts-playground
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment