Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: site/how-to clean up #1342

Merged
merged 34 commits into from
Dec 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
4eaf945
Create easy-request.md
lunamidori5 Nov 26, 2023
dbefe24
Update easy-request.md
lunamidori5 Nov 26, 2023
e96fd6b
Update easy-request.md
lunamidori5 Nov 26, 2023
bf91d59
Update easy-request.md
lunamidori5 Nov 26, 2023
37ba022
Update easy-request.md
lunamidori5 Nov 26, 2023
af4ae49
Update easy-request.md
lunamidori5 Nov 26, 2023
51dc2aa
Update easy-request-curl.md
lunamidori5 Nov 26, 2023
36e3596
Update easy-request-openai-v0.md
lunamidori5 Nov 26, 2023
ba80732
Update easy-request-openai-v1.md
lunamidori5 Nov 26, 2023
5f94bc0
Update easy-request.md
lunamidori5 Nov 26, 2023
e9e5c27
Delete docs/content/howtos/easy-request-openai-v1.md
lunamidori5 Nov 26, 2023
013e949
Delete docs/content/howtos/easy-request-openai-v0.md
lunamidori5 Nov 26, 2023
722ccaa
Delete docs/content/howtos/easy-request-curl.md
lunamidori5 Nov 26, 2023
e78b1aa
Update and rename easy-model-import-downloaded.md to easy-model.md
lunamidori5 Nov 26, 2023
3b2f2e9
Update _index.md
lunamidori5 Nov 26, 2023
f8073b0
Update easy-setup-docker-cpu.md
lunamidori5 Nov 26, 2023
eb64425
Update easy-setup-docker-gpu.md
lunamidori5 Nov 26, 2023
49b2308
Update easy-setup-docker-gpu.md
lunamidori5 Nov 26, 2023
bb65ff4
Update easy-setup-docker-cpu.md
lunamidori5 Nov 26, 2023
4393026
Merge branch 'master' into master
lunamidori5 Nov 28, 2023
dd76151
Merge branch 'mudler:master' into master
lunamidori5 Nov 29, 2023
6be13c7
Delete docs/content/howtos/autogen-setup.md
lunamidori5 Nov 29, 2023
5bf7f8b
Update _index.md
lunamidori5 Nov 29, 2023
f2e7787
Delete docs/content/howtos/easy-request-autogen.md
lunamidori5 Nov 29, 2023
4b0d328
Update easy-model.md
lunamidori5 Nov 29, 2023
8b570f8
Merge branch 'mudler:master' into master
lunamidori5 Nov 29, 2023
b469e89
Update _index.en.md
lunamidori5 Nov 29, 2023
17ddf8b
Update _index.en.md
lunamidori5 Nov 29, 2023
84b1114
Update _index.en.md
lunamidori5 Nov 29, 2023
524e8e5
Update _index.en.md
lunamidori5 Nov 29, 2023
b200b22
Update _index.md
lunamidori5 Nov 29, 2023
2fca82d
Merge branch 'master' into master
lunamidori5 Nov 30, 2023
f7693bb
Update _index.en.md
lunamidori5 Dec 1, 2023
2e5b5e4
Merge branch 'master' into master
lunamidori5 Dec 1, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/content/faq/_index.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Here are answers to some of the most common questions.

<details>

Most ggml-based models should work, but newer models may require additions to the API. If a model doesn't work, please feel free to open up issues. However, be cautious about downloading models from the internet and directly onto your machine, as there may be security vulnerabilities in lama.cpp or ggml that could be maliciously exploited. Some models can be found on Hugging Face: https://huggingface.co/models?search=ggml, or models from gpt4all are compatible too: https://github.com/nomic-ai/gpt4all.
Most gguf-based models should work, but newer models may require additions to the API. If a model doesn't work, please feel free to open up issues. However, be cautious about downloading models from the internet and directly onto your machine, as there may be security vulnerabilities in lama.cpp or ggml that could be maliciously exploited. Some models can be found on Hugging Face: https://huggingface.co/models?search=gguf, or models from gpt4all are compatible too: https://github.com/nomic-ai/gpt4all.

</details>

Expand Down
10 changes: 5 additions & 5 deletions docs/content/getting_started/_index.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ To run with GPU Accelleration, see [GPU acceleration]({{%relref "features/gpu-ac
mkdir models

# copy your models to it
cp your-model.bin models/
cp your-model.gguf models/

# run the LocalAI container
docker run -p 8080:8080 -v $PWD/models:/models -ti --rm quay.io/go-skynet/local-ai:latest --models-path /models --context-size 700 --threads 4
Expand All @@ -43,7 +43,7 @@ docker run -p 8080:8080 -v $PWD/models:/models -ti --rm quay.io/go-skynet/local-

# Try the endpoint with curl
curl http://localhost:8080/v1/completions -H "Content-Type: application/json" -d '{
"model": "your-model.bin",
"model": "your-model.gguf",
"prompt": "A long time ago in a galaxy far, far away",
"temperature": 0.7
}'
Expand All @@ -67,7 +67,7 @@ cd LocalAI
# git checkout -b build <TAG>

# copy your models to models/
cp your-model.bin models/
cp your-model.gguf models/

# (optional) Edit the .env file to set things like context size and threads
# vim .env
Expand All @@ -79,10 +79,10 @@ docker compose up -d --pull always

# Now API is accessible at localhost:8080
curl http://localhost:8080/v1/models
# {"object":"list","data":[{"id":"your-model.bin","object":"model"}]}
# {"object":"list","data":[{"id":"your-model.gguf","object":"model"}]}

curl http://localhost:8080/v1/completions -H "Content-Type: application/json" -d '{
"model": "your-model.bin",
"model": "your-model.gguf",
"prompt": "A long time ago in a galaxy far, far away",
"temperature": 0.7
}'
Expand Down
8 changes: 2 additions & 6 deletions docs/content/howtos/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,10 @@ This section includes LocalAI end-to-end examples, tutorial and how-tos curated

- [Setup LocalAI with Docker on CPU]({{%relref "howtos/easy-setup-docker-cpu" %}})
- [Setup LocalAI with Docker With CUDA]({{%relref "howtos/easy-setup-docker-gpu" %}})
- [Seting up a Model]({{%relref "howtos/easy-model-import-downloaded" %}})
- [Making requests via Autogen]({{%relref "howtos/easy-request-autogen" %}})
- [Making requests via OpenAi API V0]({{%relref "howtos/easy-request-openai-v0" %}})
- [Making requests via OpenAi API V1]({{%relref "howtos/easy-request-openai-v1" %}})
- [Making requests via Curl]({{%relref "howtos/easy-request-curl" %}})
- [Seting up a Model]({{%relref "howtos/easy-model" %}})
- [Making requests to LocalAI]({{%relref "howtos/easy-request" %}})

## Programs and Demos

This section includes other programs and how to setup, install, and use of LocalAI.
- [Python LocalAI Demo]({{%relref "howtos/easy-setup-full" %}}) - [lunamidori5](https://github.com/lunamidori5)
- [Autogen]({{%relref "howtos/autogen-setup" %}}) - [lunamidori5](https://github.com/lunamidori5)
91 changes: 0 additions & 91 deletions docs/content/howtos/autogen-setup.md

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,6 @@ What this does is tell ``LocalAI`` how to load the model. Then we are going to *
name: lunademo
parameters:
model: luna-ai-llama2-uncensored.Q4_K_M.gguf
temperature: 0.2
top_k: 40
top_p: 0.65
```

Now that we have the model set up, there a few things we should add to the yaml file to make it run better, for this model it uses the following roles.
Expand Down Expand Up @@ -100,9 +97,6 @@ context_size: 2000
name: lunademo
parameters:
model: luna-ai-llama2-uncensored.Q4_K_M.gguf
temperature: 0.2
top_k: 40
top_p: 0.65
roles:
assistant: 'ASSISTANT:'
system: 'SYSTEM:'
Expand All @@ -112,7 +106,7 @@ template:
completion: lunademo-completion
```

Now that we got that setup, lets test it out but sending a request by using [Curl]({{%relref "easy-request-curl" %}}) Or use the [OpenAI Python API]({{%relref "easy-request-openai-v1" %}})!
Now that we got that setup, lets test it out but sending a [request]({{%relref "easy-request" %}}) to Localai!

## Adv Stuff
Alright now that we have learned how to set up our own models, here is how to use the gallery to do alot of this for us. This command will download and set up (mostly, we will **always** need to edit our yaml file to fit our computer / hardware)
Expand Down
1 change: 0 additions & 1 deletion docs/content/howtos/easy-request-autogen.md

This file was deleted.

35 changes: 0 additions & 35 deletions docs/content/howtos/easy-request-curl.md

This file was deleted.

50 changes: 0 additions & 50 deletions docs/content/howtos/easy-request-openai-v0.md

This file was deleted.

28 changes: 0 additions & 28 deletions docs/content/howtos/easy-request-openai-v1.md

This file was deleted.

85 changes: 85 additions & 0 deletions docs/content/howtos/easy-request.md
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)
```
Loading