feat: provide vector store (#772)
* implement vectore store feature * fix after integration testing * fix golint error * improve test to increare code coverage * fix golint anc code coverage problem * add tool_resource in assistant response * chore: code style * feat: use pagination param * feat: use pagination param * test: use pagination param * test: rm unused code --------- Co-authored-by: Denny Depok <61371551+kodernubie@users.noreply.github.com> Co-authored-by: eric.p <eric.p>
This commit is contained in:
50
assistant.go
50
assistant.go
@@ -14,16 +14,17 @@ const (
|
||||
)
|
||||
|
||||
type Assistant struct {
|
||||
ID string `json:"id"`
|
||||
Object string `json:"object"`
|
||||
CreatedAt int64 `json:"created_at"`
|
||||
Name *string `json:"name,omitempty"`
|
||||
Description *string `json:"description,omitempty"`
|
||||
Model string `json:"model"`
|
||||
Instructions *string `json:"instructions,omitempty"`
|
||||
Tools []AssistantTool `json:"tools"`
|
||||
FileIDs []string `json:"file_ids,omitempty"`
|
||||
Metadata map[string]any `json:"metadata,omitempty"`
|
||||
ID string `json:"id"`
|
||||
Object string `json:"object"`
|
||||
CreatedAt int64 `json:"created_at"`
|
||||
Name *string `json:"name,omitempty"`
|
||||
Description *string `json:"description,omitempty"`
|
||||
Model string `json:"model"`
|
||||
Instructions *string `json:"instructions,omitempty"`
|
||||
Tools []AssistantTool `json:"tools"`
|
||||
FileIDs []string `json:"file_ids,omitempty"`
|
||||
Metadata map[string]any `json:"metadata,omitempty"`
|
||||
ToolResources *AssistantToolResource `json:"tool_resources,omitempty"`
|
||||
|
||||
httpHeader
|
||||
}
|
||||
@@ -34,6 +35,7 @@ const (
|
||||
AssistantToolTypeCodeInterpreter AssistantToolType = "code_interpreter"
|
||||
AssistantToolTypeRetrieval AssistantToolType = "retrieval"
|
||||
AssistantToolTypeFunction AssistantToolType = "function"
|
||||
AssistantToolTypeFileSearch AssistantToolType = "file_search"
|
||||
)
|
||||
|
||||
type AssistantTool struct {
|
||||
@@ -41,19 +43,33 @@ type AssistantTool struct {
|
||||
Function *FunctionDefinition `json:"function,omitempty"`
|
||||
}
|
||||
|
||||
type AssistantToolFileSearch struct {
|
||||
VectorStoreIDs []string `json:"vector_store_ids"`
|
||||
}
|
||||
|
||||
type AssistantToolCodeInterpreter struct {
|
||||
FileIDs []string `json:"file_ids"`
|
||||
}
|
||||
|
||||
type AssistantToolResource struct {
|
||||
FileSearch *AssistantToolFileSearch `json:"file_search,omitempty"`
|
||||
CodeInterpreter *AssistantToolCodeInterpreter `json:"code_interpreter,omitempty"`
|
||||
}
|
||||
|
||||
// AssistantRequest provides the assistant request parameters.
|
||||
// When modifying the tools the API functions as the following:
|
||||
// If Tools is undefined, no changes are made to the Assistant's tools.
|
||||
// If Tools is empty slice it will effectively delete all of the Assistant's tools.
|
||||
// If Tools is populated, it will replace all of the existing Assistant's tools with the provided tools.
|
||||
type AssistantRequest struct {
|
||||
Model string `json:"model"`
|
||||
Name *string `json:"name,omitempty"`
|
||||
Description *string `json:"description,omitempty"`
|
||||
Instructions *string `json:"instructions,omitempty"`
|
||||
Tools []AssistantTool `json:"-"`
|
||||
FileIDs []string `json:"file_ids,omitempty"`
|
||||
Metadata map[string]any `json:"metadata,omitempty"`
|
||||
Model string `json:"model"`
|
||||
Name *string `json:"name,omitempty"`
|
||||
Description *string `json:"description,omitempty"`
|
||||
Instructions *string `json:"instructions,omitempty"`
|
||||
Tools []AssistantTool `json:"-"`
|
||||
FileIDs []string `json:"file_ids,omitempty"`
|
||||
Metadata map[string]any `json:"metadata,omitempty"`
|
||||
ToolResources *AssistantToolResource `json:"tool_resources,omitempty"`
|
||||
}
|
||||
|
||||
// MarshalJSON provides a custom marshaller for the assistant request to handle the API use cases
|
||||
|
||||
Reference in New Issue
Block a user