Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
change
sglang
Commits
fbf42263
Commit
fbf42263
authored
Jan 16, 2024
by
Lianmin Zheng
Browse files
Update Readme (#11)
parent
2ccd9fd8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
1 deletion
+7
-1
README.md
README.md
+7
-1
No files found.
README.md
View file @
fbf42263
...
@@ -36,6 +36,12 @@ pip install -e "python[all]"
...
@@ -36,6 +36,12 @@ pip install -e "python[all]"
The example below shows how to use sglang to answer a mulit-turn question.
The example below shows how to use sglang to answer a mulit-turn question.
### Using OpenAI Models
### Using OpenAI Models
Set the OpenAI API Key
```
export OPENAI_API_KEY=sk-xxxxxx
```
Then, answer a multi-turn question.
```
python
```
python
from
sglang
import
function
,
system
,
user
,
assistant
,
gen
,
set_default_backend
,
OpenAI
from
sglang
import
function
,
system
,
user
,
assistant
,
gen
,
set_default_backend
,
OpenAI
...
@@ -99,7 +105,7 @@ To begin with, import sglang.
...
@@ -99,7 +105,7 @@ To begin with, import sglang.
import
sglang
as
sgl
import
sglang
as
sgl
```
```
`sglang`
provides some simple primitives such as
`gen`
,
`select`
,
`fork`
.
`sglang`
provides some simple primitives such as
`gen`
,
`select`
,
`fork`
,
`image`
.
You can implement your prompt flow in a function decorated by
`sgl.function`
.
You can implement your prompt flow in a function decorated by
`sgl.function`
.
You can then invoke the function with
`run`
or
`run_batch`
.
You can then invoke the function with
`run`
or
`run_batch`
.
The system will manage the state, chat template, and parallelism for you.
The system will manage the state, chat template, and parallelism for you.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment