Преглед изворни кода

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,
     max_tokens=300,
+)
+
+completion = client.completions.create(
+    model="llama3",
+    prompt="Say this is a test",
+)
 
 
 list_completion = client.models.list()
 list_completion = client.models.list()
 
 
@@ -50,7 +56,7 @@ model = client.models.retrieve("llama3")
 
 
 embeddings = client.embeddings.create(
 embeddings = client.embeddings.create(
     model="all-minilm",
     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 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({
 const embedding = await openai.embeddings.create({
   model: "all-minilm",
   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?"],
-});
+})
 ```
 ```
 
 
 ### `curl`
 ### `curl`
@@ -140,6 +151,13 @@ curl http://localhost:11434/v1/chat/completions \
     "max_tokens": 300
     "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
 
 
 curl http://localhost:11434/v1/models/llama3
 curl http://localhost:11434/v1/models/llama3
@@ -191,6 +209,39 @@ curl http://localhost:11434/v1/embeddings \
 - [ ] `user`
 - [ ] `user`
 - [ ] `n`
 - [ ] `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`
 ### `/v1/models`
 
 
 #### Notes
 #### Notes