Documentation
¶
Index ¶
- func ExpandHome(path string) string
- type APIError
- type ChunkingConfig
- type Client
- func (c *Client) CreateStore(ctx context.Context, displayName string) (*FileSearchStore, error)
- func (c *Client) DeleteDocument(ctx context.Context, docName string, force bool) error
- func (c *Client) DeleteStore(ctx context.Context, name string, force bool) error
- func (c *Client) GetDocument(ctx context.Context, docName string) (*Document, error)
- func (c *Client) GetOperation(ctx context.Context, opName string) (*Operation, error)
- func (c *Client) GetStore(ctx context.Context, name string) (*FileSearchStore, error)
- func (c *Client) ListDocuments(ctx context.Context, storeName string, pageSize int, pageToken string) (*ListDocumentsResponse, error)
- func (c *Client) ListStores(ctx context.Context, pageSize int, pageToken string) (*ListStoresResponse, error)
- func (c *Client) UploadFile(ctx context.Context, storeName, filePath string, config *UploadConfig) (*Operation, error)
- type CreateStoreRequest
- type CustomMetadata
- type Document
- type FileSearchStore
- type ListDocumentsResponse
- type ListStoresResponse
- type Operation
- type Status
- type UploadConfig
- type WhiteSpaceConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExpandHome ¶
ExpandHome expands a leading ~ to the user's home directory.
Types ¶
type APIError ¶
type APIError struct {
Error struct {
Code int `json:"code"`
Message string `json:"message"`
Status string `json:"status"`
} `json:"error"`
}
APIError represents an error response from the API.
type ChunkingConfig ¶
type ChunkingConfig struct {
WhiteSpaceConfig *WhiteSpaceConfig `json:"whiteSpaceConfig,omitempty"`
}
ChunkingConfig configures how documents are chunked.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the HTTP client for the Gemini File Search API.
func (*Client) CreateStore ¶
CreateStore creates a new FileSearchStore.
func (*Client) DeleteDocument ¶
DeleteDocument deletes a document from a FileSearchStore.
func (*Client) DeleteStore ¶
DeleteStore deletes a FileSearchStore.
func (*Client) GetDocument ¶
GetDocument retrieves a specific document.
func (*Client) GetOperation ¶
GetOperation retrieves the status of a long-running operation.
func (*Client) ListDocuments ¶
func (c *Client) ListDocuments(ctx context.Context, storeName string, pageSize int, pageToken string) (*ListDocumentsResponse, error)
ListDocuments lists documents in a FileSearchStore.
func (*Client) ListStores ¶
func (c *Client) ListStores(ctx context.Context, pageSize int, pageToken string) (*ListStoresResponse, error)
ListStores lists all FileSearchStores with pagination.
func (*Client) UploadFile ¶
func (c *Client) UploadFile(ctx context.Context, storeName, filePath string, config *UploadConfig) (*Operation, error)
UploadFile uploads a file to a FileSearchStore.
type CreateStoreRequest ¶
type CreateStoreRequest struct {
DisplayName string `json:"displayName,omitempty"`
}
CreateStoreRequest is the request body for creating a store.
type CustomMetadata ¶
type CustomMetadata struct {
Key string `json:"key"`
StringValue *string `json:"stringValue,omitempty"`
NumericValue *float64 `json:"numericValue,omitempty"`
}
CustomMetadata is a key-value pair attached to a document.
type Document ¶
type Document struct {
Name string `json:"name"`
DisplayName string `json:"displayName,omitempty"`
CustomMetadata []CustomMetadata `json:"customMetadata,omitempty"`
CreateTime string `json:"createTime,omitempty"`
UpdateTime string `json:"updateTime,omitempty"`
State string `json:"state,omitempty"`
SizeBytes int64 `json:"sizeBytes,omitempty,string"`
MimeType string `json:"mimeType,omitempty"`
}
Document represents a document within a FileSearchStore.
type FileSearchStore ¶
type FileSearchStore struct {
Name string `json:"name"`
DisplayName string `json:"displayName,omitempty"`
CreateTime string `json:"createTime,omitempty"`
UpdateTime string `json:"updateTime,omitempty"`
ActiveDocumentsCount int64 `json:"activeDocumentsCount,omitempty,string"`
PendingDocumentsCount int64 `json:"pendingDocumentsCount,omitempty,string"`
FailedDocumentsCount int64 `json:"failedDocumentsCount,omitempty,string"`
SizeBytes int64 `json:"sizeBytes,omitempty,string"`
}
FileSearchStore represents a Google Gemini File Search store.
type ListDocumentsResponse ¶
type ListDocumentsResponse struct {
Documents []Document `json:"documents"`
NextPageToken string `json:"nextPageToken,omitempty"`
}
ListDocumentsResponse is the response for listing documents.
type ListStoresResponse ¶
type ListStoresResponse struct {
FileSearchStores []FileSearchStore `json:"fileSearchStores"`
NextPageToken string `json:"nextPageToken,omitempty"`
}
ListStoresResponse is the response for listing file search stores.
type Operation ¶
type Operation struct {
Name string `json:"name"`
Metadata json.RawMessage `json:"metadata,omitempty"`
Done bool `json:"done"`
Error *Status `json:"error,omitempty"`
Response json.RawMessage `json:"response,omitempty"`
}
Operation represents a long-running operation.
type UploadConfig ¶
type UploadConfig struct {
DisplayName string `json:"displayName,omitempty"`
CustomMetadata []CustomMetadata `json:"customMetadata,omitempty"`
ChunkingConfig *ChunkingConfig `json:"chunkingConfig,omitempty"`
}
UploadConfig holds configuration for file uploads.
type WhiteSpaceConfig ¶
type WhiteSpaceConfig struct {
MaxTokensPerChunk int `json:"maxTokensPerChunk,omitempty"`
MaxOverlapTokens int `json:"maxOverlapTokens,omitempty"`
}
WhiteSpaceConfig configures whitespace-based chunking.