v0.0.13
✨ What's New
-
EmbeddingFunctionsupportdimensionsconfig for server-side embedding #184 by @Mini256embed_fn = EmbeddingFunction(model_name="text-embedding-3-small", dimensions=1024)
You can use this parameter to reduce the dimensionality of the vectors generated by the embedding model, which can reduce the storage consumption and improve the query efficiency of the vector search to some extent.
-
table.search()API and support returning Relationship Field #180 by @Mini256For example:
class Entity(TableModel): __tablename__ = "entities" id: int = Field(primary_key=True) name: str = Field() entity_table = db.create_table(schema=Entity, if_exists="skip") class Relation(TableModel): __tablename__ = "relations" id: int = Field(primary_key=True) description: str = Field() source_entity_id: int = Field(foreign_key="entities.id") target_entity_id: int = Field(foreign_key="entities.id") embedding: list[float] = text_embed.VectorField(source_field="description") source_entity: Entity = Relationship( sa_relationship_kwargs={ "primaryjoin": "Relation.source_entity_id == Entity.id", "lazy": "joined" }, ) target_entity: Entity = Relationship( sa_relationship_kwargs={ "primaryjoin": "Relation.target_entity_id == Entity.id", "lazy": "joined" }, ) relation_table = db.create_table(schema=Relation, if_exists="skip")
Now,
relation_table.search("xxxx").limit(1).to_pydantic();will return thesource_entity, andtarget_entityfield, it will help you build GraphRAG application with fewer lines of code.
📝 Documentation & Examples
- Rename "Serverless" to "Starter" #179 by @sykp241095
- Add auto embedding example for multiple model providers #181 by @Mini256
- Add custom embedding function example #167 by @Icemap
🧰 Refactor
- Move table creation logic out of
Tableconstructor #169 by @Mini256
Inittable = Table(schema=TableModel)will no create the table in database, usingtable.create()ordb.create_table(schema=TableModel)instead.
🔗 Full Changelog: v0.0.12...v0.0.13