Skip to content

Commit 80313a3

Browse files
authored
fix(py-sdk): fix type annotations (#644)
1 parent c8cb893 commit 80313a3

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

examples/text_embedding/main.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def text_to_embedding(
2525
@cocoindex.flow_def(name="TextEmbedding")
2626
def text_embedding_flow(
2727
flow_builder: cocoindex.FlowBuilder, data_scope: cocoindex.DataScope
28-
):
28+
) -> None:
2929
"""
3030
Define an example flow that embeds text into a vector database.
3131
"""
@@ -65,7 +65,7 @@ def text_embedding_flow(
6565
)
6666

6767

68-
def search(pool: ConnectionPool, query: str, top_k: int = 5):
68+
def search(pool: ConnectionPool, query: str, top_k: int = 5) -> list[dict[str, Any]]:
6969
# Get the table name, for the export target in the text_embedding_flow above.
7070
table_name = cocoindex.utils.get_target_default_name(
7171
text_embedding_flow, "doc_embeddings"
@@ -89,7 +89,7 @@ def search(pool: ConnectionPool, query: str, top_k: int = 5):
8989
]
9090

9191

92-
def _main():
92+
def _main() -> None:
9393
# Initialize the database connection pool.
9494
pool = ConnectionPool(os.getenv("COCOINDEX_DATABASE_URL"))
9595
# Run queries in a loop to demonstrate the query capabilities.

python/cocoindex/flow.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ def for_each(self, f: Callable[[DataScope], None]) -> None:
185185

186186
def transform(
187187
self, fn_spec: op.FunctionSpec, *args: Any, **kwargs: Any
188-
) -> DataSlice[T]:
188+
) -> DataSlice[Any]:
189189
"""
190190
Apply a function to the data slice.
191191
"""

0 commit comments

Comments
 (0)