docs: update API Reference threads endpoint from DevDocs (#2182)
docs: update API Reference threads endpoint from DevDocs
This commit is contained in:
commit
b03a9b245a
@ -471,8 +471,8 @@ paths:
|
|||||||
x-codeSamples:
|
x-codeSamples:
|
||||||
- lang: cURL
|
- lang: cURL
|
||||||
source: |
|
source: |
|
||||||
curl -X POST http://localhost:1337/v1/threads \
|
curl -X POST http://localhost:1337/v1/threads \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-d '{
|
-d '{
|
||||||
"messages": [{
|
"messages": [{
|
||||||
"role": "user",
|
"role": "user",
|
||||||
@ -483,6 +483,73 @@ paths:
|
|||||||
"content": "How does AI work? Explain it in simple terms."
|
"content": "How does AI work? Explain it in simple terms."
|
||||||
}]
|
}]
|
||||||
}'
|
}'
|
||||||
|
- lang: JavaScript
|
||||||
|
source: |-
|
||||||
|
const fetch = require('node-fetch');
|
||||||
|
|
||||||
|
fetch('http://localhost:1337/v1/threads', {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
body: JSON.stringify({
|
||||||
|
messages: [
|
||||||
|
{
|
||||||
|
role: 'user',
|
||||||
|
content: 'Hello, what is AI?',
|
||||||
|
file_ids: ['file-abc123']
|
||||||
|
},
|
||||||
|
{
|
||||||
|
role: 'user',
|
||||||
|
content: 'How does AI work? Explain it in simple terms.'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
})
|
||||||
|
});
|
||||||
|
- lang: Node.js
|
||||||
|
source: |-
|
||||||
|
const fetch = require('node-fetch');
|
||||||
|
|
||||||
|
fetch('http://localhost:1337/v1/threads', {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
body: JSON.stringify({
|
||||||
|
messages: [
|
||||||
|
{
|
||||||
|
role: 'user',
|
||||||
|
content: 'Hello, what is AI?',
|
||||||
|
file_ids: ['file-abc123']
|
||||||
|
},
|
||||||
|
{
|
||||||
|
role: 'user',
|
||||||
|
content: 'How does AI work? Explain it in simple terms.'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
})
|
||||||
|
});
|
||||||
|
- lang: Python
|
||||||
|
source: |-
|
||||||
|
import requests
|
||||||
|
|
||||||
|
url = 'http://localhost:1337/v1/threads'
|
||||||
|
payload = {
|
||||||
|
'messages': [
|
||||||
|
{
|
||||||
|
'role': 'user',
|
||||||
|
'content': 'Hello, what is AI?',
|
||||||
|
'file_ids': ['file-abc123']
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'role': 'user',
|
||||||
|
'content': 'How does AI work? Explain it in simple terms.'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
response = requests.post(url, json=payload)
|
||||||
|
print(response.text)
|
||||||
get:
|
get:
|
||||||
operationId: listThreads
|
operationId: listThreads
|
||||||
tags:
|
tags:
|
||||||
@ -516,9 +583,36 @@ paths:
|
|||||||
metadata: {}
|
metadata: {}
|
||||||
x-codeSamples:
|
x-codeSamples:
|
||||||
- lang: cURL
|
- lang: cURL
|
||||||
source: |
|
source: |-
|
||||||
curl http://localhost:1337/v1/threads \
|
curl http://localhost:1337/v1/threads \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json"
|
||||||
|
- lang: JavaScript
|
||||||
|
source: |-
|
||||||
|
const fetch = require('node-fetch');
|
||||||
|
|
||||||
|
fetch('http://localhost:1337/v1/threads', {
|
||||||
|
method: 'GET',
|
||||||
|
headers: {'Content-Type': 'application/json'}
|
||||||
|
}).then(res => res.json())
|
||||||
|
.then(json => console.log(json));
|
||||||
|
- lang: Node.js
|
||||||
|
source: |-
|
||||||
|
const fetch = require('node-fetch');
|
||||||
|
|
||||||
|
fetch('http://localhost:1337/v1/threads', {
|
||||||
|
method: 'GET',
|
||||||
|
headers: {'Content-Type': 'application/json'}
|
||||||
|
}).then(res => res.json())
|
||||||
|
.then(json => console.log(json));
|
||||||
|
- lang: Python
|
||||||
|
source: |-
|
||||||
|
import requests
|
||||||
|
|
||||||
|
url = 'http://localhost:1337/v1/threads'
|
||||||
|
headers = {'Content-Type': 'application/json'}
|
||||||
|
|
||||||
|
response = requests.get(url, headers=headers)
|
||||||
|
print(response.json())
|
||||||
/threads/{thread_id}:
|
/threads/{thread_id}:
|
||||||
get:
|
get:
|
||||||
operationId: getThread
|
operationId: getThread
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user