浏览代码

Update OpenAI Compatibility Docs with /v1/completions (#5311)

* Update docs

* token bug corrected

* Update docs/openai.md

* Update docs/openai.md

* add suffix

* merge conflicts

* merge conflicts
royjhan 9 月之前
父节点
当前提交
4addf6b587
共有 1 个文件被更改,包括 54 次插入3 次删除
  1. 54 3
      docs/openai.md

+ 54 - 3
docs/openai.md

@@ -43,6 +43,12 @@ response = client.chat.completions.create(
         }
     ],
     max_tokens=300,
+)
+
+completion = client.completions.create(
+    model="llama3",
+    prompt="Say this is a test",
+)
 
 list_completion = client.models.list()
 
@@ -50,7 +56,7 @@ model = client.models.retrieve("llama3")
 
 embeddings = client.embeddings.create(
     model="all-minilm",
-    input=["why is the sky blue?", "why is the grass green?"]
+    input=["why is the sky blue?", "why is the grass green?"],
 )
 ```
 
@@ -87,14 +93,19 @@ const response = await openai.chat.completions.create({
     ],
 })
 
+const completion = await openai.completions.create({
+    model: "llama3",
+    prompt: "Say this is a test.",
+})
+
 const listCompletion = await openai.models.list()
 
-const model = await openai.models.retrieve("llama3");
+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`
@@ -140,6 +151,13 @@ curl http://localhost:11434/v1/chat/completions \
     "max_tokens": 300
   }'
 
+curl http://localhost:11434/v1/completions \
+    -H "Content-Type: application/json" \
+    -d '{
+        "model": "llama3",
+        "prompt": "Say this is a test"
+    }'
+
 curl http://localhost:11434/v1/models
 
 curl http://localhost:11434/v1/models/llama3
@@ -191,6 +209,39 @@ curl http://localhost:11434/v1/embeddings \
 - [ ] `user`
 - [ ] `n`
 
+### `/v1/completions`
+
+#### Supported features
+
+- [x] Completions
+- [x] Streaming
+- [x] JSON mode
+- [x] Reproducible outputs
+- [ ] Logprobs
+
+#### Supported request fields
+
+- [x] `model`
+- [x] `prompt`
+- [x] `frequency_penalty`
+- [x] `presence_penalty`
+- [x] `seed`
+- [x] `stop`
+- [x] `stream`
+- [x] `temperature`
+- [x] `top_p`
+- [x] `max_tokens`
+- [x] `suffix`
+- [ ] `best_of`
+- [ ] `echo`
+- [ ] `logit_bias`
+- [ ] `user`
+- [ ] `n`
+
+#### Notes
+
+- `prompt` currently only accepts a string
+
 ### `/v1/models`
 
 #### Notes