diff --git a/internal/gen/db_control/db_control_2024-10.oas.go b/internal/gen/db_control/db_control_2024-10.oas.go index 9415ad2..83ff61e 100644 --- a/internal/gen/db_control/db_control_2024-10.oas.go +++ b/internal/gen/db_control/db_control_2024-10.oas.go @@ -134,7 +134,7 @@ type ConfigureIndexRequest struct { } `json:"spec,omitempty"` // Tags Custom user tags added to an index. Keys must be alphanumeric and 80 characters or less. Values must be 120 characters or less. - Tags *IndexTags `json:"tags,omitempty"` + Tags *IndexTags `json:"tags"` } // CreateCollectionRequest The configuration needed to create a Pinecone collection. @@ -166,7 +166,7 @@ type CreateIndexRequest struct { Spec IndexSpec `json:"spec"` // Tags Custom user tags added to an index. Keys must be alphanumeric and 80 characters or less. Values must be 120 characters or less. - Tags *IndexTags `json:"tags,omitempty"` + Tags *IndexTags `json:"tags"` } // CreateIndexRequestMetric The distance metric to be used for similarity search. You can use 'euclidean', 'cosine', or 'dotproduct'. @@ -227,7 +227,7 @@ type IndexModel struct { } `json:"status"` // Tags Custom user tags added to an index. Keys must be alphanumeric and 80 characters or less. Values must be 120 characters or less. - Tags *IndexTags `json:"tags,omitempty"` + Tags *IndexTags `json:"tags"` } // IndexModelMetric The distance metric to be used for similarity search. You can use 'euclidean', 'cosine', or 'dotproduct'. @@ -255,7 +255,7 @@ type IndexSpec0 = interface{} type IndexSpec1 = interface{} // IndexTags Custom user tags added to an index. Keys must be alphanumeric and 80 characters or less. Values must be 120 characters or less. -type IndexTags map[string]*string +type IndexTags map[string]string // PodSpec Configuration needed to deploy a pod-based index. type PodSpec struct { diff --git a/internal/gen/db_data/rest/db_data_2024-10.oas.go b/internal/gen/db_data/rest/db_data_2024-10.oas.go index a684d33..755b14d 100644 --- a/internal/gen/db_data/rest/db_data_2024-10.oas.go +++ b/internal/gen/db_data/rest/db_data_2024-10.oas.go @@ -271,7 +271,7 @@ type StartImportRequest struct { IntegrationId *string `json:"integrationId,omitempty"` // Uri The URI prefix under which the data to import is available. All data within this prefix will be listed then imported into the target index. Currently only `s3://` URIs are supported. - Uri *string `json:"uri,omitempty"` + Uri string `json:"uri"` } // StartImportResponse The response for the `start_import` operation. diff --git a/pinecone/client.go b/pinecone/client.go index 89f8865..5b38c22 100644 --- a/pinecone/client.go +++ b/pinecone/client.go @@ -1225,6 +1225,14 @@ func (c *Client) DeleteCollection(ctx context.Context, collectionName string) er return nil } +// InferenceService is a struct which exposes methods for interacting with the Pinecone Inference API. InferenceService +// can be accessed via the Client object through the Client.Inference namespace. +// +// [Pinecone Inference API]: https://docs.pinecone.io/guides/inference/understanding-inference#embedding-models +type InferenceService struct { + client *inference.Client +} + // EmbedRequest holds the parameters for generating embeddings for a list of input strings. // // Fields: @@ -1248,12 +1256,20 @@ type EmbedParameters struct { Truncate string } -// InferenceService is a struct which exposes methods for interacting with the Pinecone Inference API. InferenceService -// can be accessed via the Client object through the Client.Inference namespace. +// EmbedResponse represents holds the embeddings generated for a single input. // -// [Pinecone Inference API]: https://docs.pinecone.io/guides/inference/understanding-inference#embedding-models -type InferenceService struct { - client *inference.Client +// Fields: +// - Data: A list of Embedding objects containing the embeddings generated for the input. +// - Model: The model used to generate the embeddings. +// - Usage: Usage statistics ([Total Tokens]) for the request. +// +// [Total Tokens]: https://docs.pinecone.io/guides/organizations/manage-cost/understanding-cost#embed +type EmbedResponse struct { + Data []Embedding `json:"data"` + Model string `json:"model"` + Usage struct { + TotalTokens *int `json:"total_tokens,omitempty"` + } `json:"usage"` } // Embed generates embeddings for a list of inputs using the specified model and (optional) parameters. @@ -1298,7 +1314,7 @@ type InferenceService struct { // } else { // fmt.Printf("Successfull generated embeddings: %+v", res) // } -func (i *InferenceService) Embed(ctx context.Context, in *EmbedRequest) (*inference.EmbeddingsList, error) { +func (i *InferenceService) Embed(ctx context.Context, in *EmbedRequest) (*EmbedResponse, error) { if len(in.TextInputs) == 0 { return nil, fmt.Errorf("TextInputs must contain at least one value") @@ -1537,8 +1553,8 @@ func decodeIndex(resBody io.ReadCloser) (*Index, error) { return toIndex(&idx), nil } -func decodeEmbeddingsList(resBody io.ReadCloser) (*inference.EmbeddingsList, error) { - var embeddingsList inference.EmbeddingsList +func decodeEmbeddingsList(resBody io.ReadCloser) (*EmbedResponse, error) { + var embeddingsList EmbedResponse err := json.NewDecoder(resBody).Decode(&embeddingsList) if err != nil { return nil, fmt.Errorf("failed to decode embeddings response: %w", err) diff --git a/pinecone/index_connection.go b/pinecone/index_connection.go index a850be1..912d9dd 100644 --- a/pinecone/index_connection.go +++ b/pinecone/index_connection.go @@ -1065,7 +1065,7 @@ func (idx *IndexConnection) StartImport(ctx context.Context, uri string, integra } req := db_data_rest.StartImportRequest{ - Uri: &uri, + Uri: uri, IntegrationId: integrationId, } diff --git a/pinecone/models.go b/pinecone/models.go index 43d71c6..8a27551 100644 --- a/pinecone/models.go +++ b/pinecone/models.go @@ -177,6 +177,13 @@ type MetadataFilter = structpb.Struct // [attached to, or updated for, a vector]: https://docs.pinecone.io/guides/data/filter-with-metadata#inserting-metadata-into-an-index type Metadata = structpb.Struct +// The embedding of a single input which is returned after [generating embeddings]. +// +// [generating embeddings]: https://docs.pinecone.io/guides/inference/generate-embeddings#3-generate-embeddings +type Embedding struct { + Values *[]float32 `json:"values,omitempty"` +} + // ImportStatus represents the status of an import operation. // // Values: