Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename Filter to MetadataFilter for clarity #39

Merged
merged 1 commit into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions pinecone/index_connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -387,14 +387,14 @@ func (idx *IndexConnection) ListVectors(ctx context.Context, in *ListVectorsRequ
// Fields:
// - Vector: The query vector used to find similar vectors.
// - TopK: The number of vectors to return.
// - Filter: The filter to apply to your query.
// - MetadataFilter: The filter to apply to your query.
// - IncludeValues: Whether to include the values of the vectors in the response.
// - IncludeMetadata: Whether to include the metadata associated with the vectors in the response.
// - SparseValues: The sparse values of the query vector, if applicable.
type QueryByVectorValuesRequest struct {
Vector []float32
TopK uint32
Filter *Filter
Filter *MetadataFilter
IncludeValues bool
IncludeMetadata bool
SparseValues *SparseValues
Expand Down Expand Up @@ -471,7 +471,7 @@ type QueryVectorsResponse struct {
// res, err := idxConnection.QueryByVectorValues(ctx, &pinecone.QueryByVectorValuesRequest{
// Vector: queryVector,
// TopK: topK, // number of vectors to be returned
// Filter: metadataFilter,
// MetadataFilter: metadataFilter,
// SparseValues: &sparseValues,
// IncludeValues: true,
// IncludeMetadata: true,
Expand Down Expand Up @@ -504,14 +504,14 @@ func (idx *IndexConnection) QueryByVectorValues(ctx context.Context, in *QueryBy
// Fields:
// - VectorId: The unique ID of the vector used to find similar vectors.
// - TopK: The number of vectors to return.
// - Filter: The filter to apply to your query.
// - MetadataFilter: The filter to apply to your query.
// - IncludeValues: Whether to include the values of the vectors in the response.
// - IncludeMetadata: Whether to include the metadata associated with the vectors in the response.
// - SparseValues: The sparse values of the query vector, if applicable.
type QueryByVectorIdRequest struct {
VectorId string
TopK uint32
Filter *Filter
Filter *MetadataFilter
IncludeValues bool
IncludeMetadata bool
SparseValues *SparseValues
Expand Down Expand Up @@ -700,7 +700,7 @@ func (idx *IndexConnection) DeleteVectorsById(ctx context.Context, ids []string)
// if err != nil {
// log.Fatalf("Failed to delete vector(s) with filter: %+v. Error: %s\n", filter, err)
// }
func (idx *IndexConnection) DeleteVectorsByFilter(ctx context.Context, filter *Filter) error {
func (idx *IndexConnection) DeleteVectorsByFilter(ctx context.Context, filter *MetadataFilter) error {
req := data.DeleteRequest{
Filter: filter,
Namespace: idx.Namespace,
Expand Down Expand Up @@ -953,7 +953,7 @@ func (idx *IndexConnection) DescribeIndexStats(ctx context.Context) (*DescribeIn
// fmt.Printf("Namespace: \"%s\", has %d vector(s) that match the given filter\n", name, summary.VectorCount)
// }
// }
func (idx *IndexConnection) DescribeIndexStatsFiltered(ctx context.Context, filter *Filter) (*DescribeIndexStatsResponse, error) {
func (idx *IndexConnection) DescribeIndexStatsFiltered(ctx context.Context, filter *MetadataFilter) (*DescribeIndexStatsResponse, error) {
req := &data.DescribeIndexStatsRequest{
Filter: filter,
}
Expand Down
2 changes: 1 addition & 1 deletion pinecone/index_connection_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ func (ts *IndexConnectionTests) TestDescribeIndexStats() {

func (ts *IndexConnectionTests) TestDescribeIndexStatsFiltered() {
ctx := context.Background()
res, err := ts.idxConn.DescribeIndexStatsFiltered(ctx, &Filter{})
res, err := ts.idxConn.DescribeIndexStatsFiltered(ctx, &MetadataFilter{})
assert.NoError(ts.T(), err)
assert.NotNil(ts.T(), res)
}
Expand Down
4 changes: 2 additions & 2 deletions pinecone/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,11 @@ type Usage struct {
ReadUnits uint32 `json:"read_units"`
}

// Filter represents the [metadata filters] attached to a Pinecone request.
// MetadataFilter represents the [metadata filters] attached to a Pinecone request.
// These optional metadata filters are applied to query and deletion requests.
//
// [metadata filters]: https://docs.pinecone.io/guides/data/filter-with-metadata#querying-an-index-with-metadata-filters
type Filter = structpb.Struct
type MetadataFilter = structpb.Struct

// Metadata represents optional,
// additional information that can be [attached to, or updated for, a vector] in a Pinecone Index.
Expand Down
Loading