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
OpenDAS
ollama
Commits
558a54b0
Unverified
Commit
558a54b0
authored
Aug 01, 2024
by
royjhan
Committed by
GitHub
Aug 01, 2024
Browse files
Update OpenAI Compatibility Docs with /v1/embeddings (#5470)
* docs without usage * no usage * rm metric note
parent
ed52833b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
0 deletions
+31
-0
docs/openai.md
docs/openai.md
+31
-0
No files found.
docs/openai.md
View file @
558a54b0
...
...
@@ -31,6 +31,11 @@ chat_completion = client.chat.completions.create(
list_completion
=
client
.
models
.
list
()
model
=
client
.
models
.
retrieve
(
"llama3"
)
embeddings
=
client
.
embeddings
.
create
(
model
=
"all-minilm"
,
input
=
[
"why is the sky blue?"
,
"why is the grass green?"
]
)
```
### OpenAI JavaScript library
...
...
@@ -53,6 +58,11 @@ const chatCompletion = await openai.chat.completions.create({
const
listCompletion
=
await
openai
.
models
.
list
()
const
model
=
await
openai
.
models
.
retrieve
(
"
llama3
"
);
const
embedding
=
await
openai
.
embeddings
.
create
({
model
:
"
all-minilm
"
,
input
:
[
"
why is the sky blue?
"
,
"
why is the grass green?
"
],
});
```
### `curl`
...
...
@@ -77,6 +87,13 @@ curl http://localhost:11434/v1/chat/completions \
curl http://localhost:11434/v1/models
curl https://api.openai.com/v1/models/llama3
curl http://localhost:11434/v1/embeddings \
-H "Content-Type: application/json" \
-d '{
"model": "all-minilm",
"input": ["why is the sky blue?", "why is the grass green?"]
}'
```
## Endpoints
...
...
@@ -128,6 +145,20 @@ curl https://api.openai.com/v1/models/llama3
-
`created`
corresponds to when the model was last modified
-
`owned_by`
corresponds to the ollama username, defaulting to
`"library"`
### `/v1/embeddings`
#### Supported request fields
-
[x]
`model`
-
[x]
`input`
-
[x] string
-
[x] array of strings
-
[ ] array of tokens
-
[ ] array of token arrays
-
[ ]
`encoding format`
-
[ ]
`dimensions`
-
[ ]
`user`
## Models
Before using a model, pull it locally
`ollama pull`
:
...
...
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