Feature/OpenAI Assistant V2 (#2258)

* add gpt4 turbo to assistant

* OpenAI Assistant V2

* update langfuse handler
This commit is contained in:
Henry Heng
2024-04-25 20:14:04 +01:00
committed by GitHub
parent 4782c0f6fc
commit 7360d1d9a6
25 changed files with 23422 additions and 17637 deletions
+44 -7
View File
@@ -1,20 +1,49 @@
import client from './client'
// OpenAI Assistant
const getAssistantObj = (id, credentialId) => client.get(`/openai-assistants/${id}?credential=${credentialId}`)
const getAllAvailableAssistants = (credentialId) => client.get(`/openai-assistants?credential=${credentialId}`)
// Assistant
const createNewAssistant = (body) => client.post(`/assistants`, body)
const getAllAssistants = () => client.get('/assistants')
const getSpecificAssistant = (id) => client.get(`/assistants/${id}`)
const getAssistantObj = (id, credential) => client.get(`/openai-assistants/${id}?credential=${credential}`)
const getAllAvailableAssistants = (credential) => client.get(`/openai-assistants?credential=${credential}`)
const createNewAssistant = (body) => client.post(`/assistants`, body)
const updateAssistant = (id, body) => client.put(`/assistants/${id}`, body)
const deleteAssistant = (id, isDeleteBoth) =>
isDeleteBoth ? client.delete(`/assistants/${id}?isDeleteBoth=true`) : client.delete(`/assistants/${id}`)
// Vector Store
const getAssistantVectorStore = (id, credentialId) => client.get(`/openai-assistants-vector-store/${id}?credential=${credentialId}`)
const listAssistantVectorStore = (credentialId) => client.get(`/openai-assistants-vector-store?credential=${credentialId}`)
const createAssistantVectorStore = (credentialId, body) => client.post(`/openai-assistants-vector-store?credential=${credentialId}`, body)
const updateAssistantVectorStore = (id, credentialId, body) =>
client.put(`/openai-assistants-vector-store/${id}?credential=${credentialId}`, body)
const deleteAssistantVectorStore = (id, credentialId) => client.delete(`/openai-assistants-vector-store/${id}?credential=${credentialId}`)
// Vector Store Files
const uploadFilesToAssistantVectorStore = (id, credentialId, formData) =>
client.post(`/openai-assistants-vector-store/${id}?credential=${credentialId}`, formData, {
headers: { 'Content-Type': 'multipart/form-data' }
})
const deleteFilesFromAssistantVectorStore = (id, credentialId, body) =>
client.patch(`/openai-assistants-vector-store/${id}?credential=${credentialId}`, body)
// Files
const uploadFilesToAssistant = (credentialId, formData) =>
client.post(`/openai-assistants-file/upload?credential=${credentialId}`, formData, {
headers: { 'Content-Type': 'multipart/form-data' }
})
export default {
getAllAssistants,
getSpecificAssistant,
@@ -22,5 +51,13 @@ export default {
getAllAvailableAssistants,
createNewAssistant,
updateAssistant,
deleteAssistant
deleteAssistant,
getAssistantVectorStore,
listAssistantVectorStore,
updateAssistantVectorStore,
createAssistantVectorStore,
uploadFilesToAssistant,
uploadFilesToAssistantVectorStore,
deleteFilesFromAssistantVectorStore,
deleteAssistantVectorStore
}