Skip to content

Conversation

@jhamon
Copy link
Collaborator

@jhamon jhamon commented Jan 28, 2026

Summary

Add user-friendly schema field type classes for defining index schemas with typed fields.

Closes SDK-101

Field Types

Class API Type Key Parameters
TextField string filterable, full_text_searchable
IntegerField integer filterable
FloatField float filterable
DenseVectorField dense_vector dimension, metric
SparseVectorField sparse_vector metric
SemanticTextField semantic_text model, field_map

Usage Example

from pinecone import TextField, DenseVectorField, IntegerField

pc.create_index(
    name="my-index",
    schema={
        "title": TextField(full_text_searchable=True),
        "year": IntegerField(filterable=True),
        "embedding": DenseVectorField(dimension=1536, metric="cosine"),
    },
    deployment=ServerlessDeployment(cloud="aws", region="us-east-1"),
)

Test Plan

  • Unit tests for each field type serialization (25 tests)
  • Tests for default values
  • Tests for all configuration options
  • mypy type checking passes

Notes

The unit tests use a workaround to load the schema_fields module directly, bypassing the broken import chain in db_control caused by the alpha API changes. This will be fixed in SDK-104/107.


Note

Low Risk
Low risk: this is additive API surface (new dataclasses + exports) with straightforward serialization logic and unit coverage; minimal chance of impacting existing behavior beyond import/export wiring.

Overview
Adds new schema field type helpers in db_control/models/schema_fields.py (TextField, IntegerField, FloatField, DenseVectorField, SparseVectorField, SemanticTextField, plus SchemaField) that serialize via to_dict() into the API’s expected schema format.

Exports these types through pinecone.db_control.models and top-level pinecone via lazy imports, and adds unit tests validating default values and to_dict() output for each field type (with a temporary direct-module-load workaround in the tests).

Written by Cursor Bugbot for commit f8b8af6. This will update automatically on new commits. Configure here.

Add user-friendly schema field classes for defining index schemas:
- TextField: for string fields with filterable/full_text_searchable options
- IntegerField: for integer fields with filterable option
- FloatField: for float fields with filterable option
- DenseVectorField: for dense vector embeddings with dimension/metric
- SparseVectorField: for sparse vector embeddings
- SemanticTextField: for integrated inference with model configuration

Each class provides a to_dict() method that serializes to the API format.

Closes SDK-101
@jhamon jhamon marked this pull request as ready for review January 28, 2026 17:48
@jhamon jhamon added the enhancement New feature or request label Jan 28, 2026
@jhamon jhamon merged commit dbca0de into fts Jan 28, 2026
7 checks passed
@jhamon jhamon deleted the jhamon/sdk-101-schema-field-type-classes branch January 28, 2026 18:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants