Skip to content

Commit

Permalink
Support Tool Resources properties for Threads
Browse files Browse the repository at this point in the history
  • Loading branch information
pkosiec committed May 29, 2024
1 parent 211cb49 commit 0f2fb44
Showing 1 changed file with 42 additions and 7 deletions.
49 changes: 42 additions & 7 deletions thread.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,56 @@ const (
)

type Thread struct {
ID string `json:"id"`
Object string `json:"object"`
CreatedAt int64 `json:"created_at"`
Metadata map[string]any `json:"metadata"`
ID string `json:"id"`
Object string `json:"object"`
CreatedAt int64 `json:"created_at"`
Metadata map[string]any `json:"metadata"`
ToolResources ToolResources `json:"tool_resources,omitempty"`

httpHeader
}

type ThreadRequest struct {
Messages []ThreadMessage `json:"messages,omitempty"`
Metadata map[string]any `json:"metadata,omitempty"`
Messages []ThreadMessage `json:"messages,omitempty"`
Metadata map[string]any `json:"metadata,omitempty"`
ToolResources ToolResourcesRequest `json:"tool_resources,omitempty"`
}

type ToolResources struct {
CodeInterpreter *CodeInterpreterToolResources `json:"code_interpreter,omitempty"`
FileSearch *FileSearchToolResources `json:"file_search,omitempty"`
}

type CodeInterpreterToolResources struct {
FileIDs []string `json:"file_ids,omitempty"`
}

type FileSearchToolResources struct {
VectorStoreIDs []string `json:"vector_store_ids,omitempty"`
}

type ToolResourcesRequest struct {
CodeInterpreter *CodeInterpreterToolResourcesRequest `json:"code_interpreter,omitempty"`
FileSearch *FileSearchToolResourcesRequest `json:"file_search,omitempty"`
}

type CodeInterpreterToolResourcesRequest struct {
FileIDs []string `json:"file_ids,omitempty"`
}

type FileSearchToolResourcesRequest struct {
VectorStoreIDs []string `json:"vector_store_ids,omitempty"`
VectorStores []VectorStoreToolResources `json:"vector_stores,omitempty"`
}

type VectorStoreToolResources struct {
FileIDs []string `json:"file_ids,omitempty"`
Metadata map[string]any `json:"metadata,omitempty"`
}

type ModifyThreadRequest struct {
Metadata map[string]any `json:"metadata"`
Metadata map[string]any `json:"metadata"`
ToolResources ToolResources `json:"tool_resources,omitempty"`
}

type ThreadMessageRole string
Expand Down

0 comments on commit 0f2fb44

Please sign in to comment.