-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Site Clean up - How to Clean up (#1342)
* Create easy-request.md Signed-off-by: lunamidori5 <118759930+lunamidori5@users.noreply.github.com> * Update easy-request.md Signed-off-by: lunamidori5 <118759930+lunamidori5@users.noreply.github.com> * Update easy-request.md Signed-off-by: lunamidori5 <118759930+lunamidori5@users.noreply.github.com> * Update easy-request.md Signed-off-by: lunamidori5 <118759930+lunamidori5@users.noreply.github.com> * Update easy-request.md Signed-off-by: lunamidori5 <118759930+lunamidori5@users.noreply.github.com> * Update easy-request.md Signed-off-by: lunamidori5 <118759930+lunamidori5@users.noreply.github.com> * Update easy-request-curl.md Signed-off-by: lunamidori5 <118759930+lunamidori5@users.noreply.github.com> * Update easy-request-openai-v0.md Signed-off-by: lunamidori5 <118759930+lunamidori5@users.noreply.github.com> * Update easy-request-openai-v1.md Signed-off-by: lunamidori5 <118759930+lunamidori5@users.noreply.github.com> * Update easy-request.md Signed-off-by: lunamidori5 <118759930+lunamidori5@users.noreply.github.com> * Delete docs/content/howtos/easy-request-openai-v1.md Signed-off-by: lunamidori5 <118759930+lunamidori5@users.noreply.github.com> * Delete docs/content/howtos/easy-request-openai-v0.md Signed-off-by: lunamidori5 <118759930+lunamidori5@users.noreply.github.com> * Delete docs/content/howtos/easy-request-curl.md Signed-off-by: lunamidori5 <118759930+lunamidori5@users.noreply.github.com> * Update and rename easy-model-import-downloaded.md to easy-model.md Signed-off-by: lunamidori5 <118759930+lunamidori5@users.noreply.github.com> * Update _index.md Signed-off-by: lunamidori5 <118759930+lunamidori5@users.noreply.github.com> * Update easy-setup-docker-cpu.md Signed-off-by: lunamidori5 <118759930+lunamidori5@users.noreply.github.com> * Update easy-setup-docker-gpu.md Signed-off-by: lunamidori5 <118759930+lunamidori5@users.noreply.github.com> * Update easy-setup-docker-gpu.md Signed-off-by: lunamidori5 <118759930+lunamidori5@users.noreply.github.com> * Update easy-setup-docker-cpu.md Signed-off-by: lunamidori5 <118759930+lunamidori5@users.noreply.github.com> * Delete docs/content/howtos/autogen-setup.md Signed-off-by: lunamidori5 <118759930+lunamidori5@users.noreply.github.com> * Update _index.md Signed-off-by: lunamidori5 <118759930+lunamidori5@users.noreply.github.com> * Delete docs/content/howtos/easy-request-autogen.md Signed-off-by: lunamidori5 <118759930+lunamidori5@users.noreply.github.com> * Update easy-model.md Signed-off-by: lunamidori5 <118759930+lunamidori5@users.noreply.github.com> * Update _index.en.md Signed-off-by: lunamidori5 <118759930+lunamidori5@users.noreply.github.com> * Update _index.en.md Signed-off-by: lunamidori5 <118759930+lunamidori5@users.noreply.github.com> * Update _index.en.md Signed-off-by: lunamidori5 <118759930+lunamidori5@users.noreply.github.com> * Update _index.en.md Signed-off-by: lunamidori5 <118759930+lunamidori5@users.noreply.github.com> * Update _index.md Signed-off-by: lunamidori5 <118759930+lunamidori5@users.noreply.github.com> --------- Signed-off-by: lunamidori5 <118759930+lunamidori5@users.noreply.github.com>
- Loading branch information
1 parent
2b2007a
commit 6b312a8
Showing
14 changed files
with
102 additions
and
230 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
|
||
+++ | ||
disableToc = false | ||
title = "Easy Request - All" | ||
weight = 2 | ||
+++ | ||
|
||
## Curl Request | ||
|
||
Curl Chat API - | ||
|
||
```bash | ||
curl http://localhost:8080/v1/chat/completions -H "Content-Type: application/json" -d '{ | ||
"model": "lunademo", | ||
"messages": [{"role": "user", "content": "How are you?"}], | ||
"temperature": 0.9 | ||
}' | ||
``` | ||
|
||
## Openai V1 - Recommended | ||
|
||
This is for Python, ``OpenAI``=>``V1`` | ||
|
||
OpenAI Chat API Python - | ||
```python | ||
from openai import OpenAI | ||
|
||
client = OpenAI(base_url="http://localhost:8080/v1", api_key="sk-xxx") | ||
|
||
messages = [ | ||
{"role": "system", "content": "You are LocalAI, a helpful, but really confused ai, you will only reply with confused emotes"}, | ||
{"role": "user", "content": "Hello How are you today LocalAI"} | ||
] | ||
completion = client.chat.completions.create( | ||
model="lunademo", | ||
messages=messages, | ||
) | ||
|
||
print(completion.choices[0].message) | ||
``` | ||
See [OpenAI API](https://platform.openai.com/docs/api-reference) for more info! | ||
|
||
## Openai V0 - Not Recommended | ||
|
||
This is for Python, ``OpenAI``=``0.28.1`` | ||
|
||
OpenAI Chat API Python - | ||
|
||
```python | ||
import os | ||
import openai | ||
openai.api_base = "http://localhost:8080/v1" | ||
openai.api_key = "sx-xxx" | ||
OPENAI_API_KEY = "sx-xxx" | ||
os.environ['OPENAI_API_KEY'] = OPENAI_API_KEY | ||
|
||
completion = openai.ChatCompletion.create( | ||
model="lunademo", | ||
messages=[ | ||
{"role": "system", "content": "You are LocalAI, a helpful, but really confused ai, you will only reply with confused emotes"}, | ||
{"role": "user", "content": "How are you?"} | ||
] | ||
) | ||
|
||
print(completion.choices[0].message.content) | ||
``` | ||
|
||
OpenAI Completion API Python - | ||
|
||
```python | ||
import os | ||
import openai | ||
openai.api_base = "http://localhost:8080/v1" | ||
openai.api_key = "sx-xxx" | ||
OPENAI_API_KEY = "sx-xxx" | ||
os.environ['OPENAI_API_KEY'] = OPENAI_API_KEY | ||
|
||
completion = openai.Completion.create( | ||
model="lunademo", | ||
prompt="function downloadFile(string url, string outputPath) ", | ||
max_tokens=256, | ||
temperature=0.5) | ||
|
||
print(completion.choices[0].text) | ||
``` |
Oops, something went wrong.