From be4be34d879071d1484478f30818a93a0bc4902b Mon Sep 17 00:00:00 2001 From: LJ Date: Mon, 19 May 2025 18:12:34 -0700 Subject: [PATCH 1/2] docs: add documentation for `eval_async()` --- docs/docs/query.mdx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/docs/query.mdx b/docs/docs/query.mdx index 31a954e5..ded39c79 100644 --- a/docs/docs/query.mdx +++ b/docs/docs/query.mdx @@ -31,7 +31,7 @@ In this case, you can: 3. At query time, you usually want to directly run the function with specific input data, instead of letting it called as part of a long-lived indexing flow. To do this, declare the function as a *transform flow*, by decorating it with `@cocoindex.transform_flow()`. - This will add a `eval()` method to the function, so that you can directly call with specific input data. + This will add `eval()` / `eval_async()` methods to the function, so that you can directly call with specific input data. @@ -67,6 +67,12 @@ Any time, you can call the `eval()` method with specific string, which will retu print(text_to_embedding.eval("Hello, world!")) ``` +If you're in an async context, please call the `eval_async()` method instead: + +```python +print(await text_to_embedding.eval_async("Hello, world!")) +``` + From 862b9c65da14a5bf5b3083779f96cdce514f7f26 Mon Sep 17 00:00:00 2001 From: LJ Date: Mon, 19 May 2025 18:14:57 -0700 Subject: [PATCH 2/2] style: minor words --- docs/docs/query.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/docs/query.mdx b/docs/docs/query.mdx index ded39c79..5ad9fc4f 100644 --- a/docs/docs/query.mdx +++ b/docs/docs/query.mdx @@ -31,7 +31,7 @@ In this case, you can: 3. At query time, you usually want to directly run the function with specific input data, instead of letting it called as part of a long-lived indexing flow. To do this, declare the function as a *transform flow*, by decorating it with `@cocoindex.transform_flow()`. - This will add `eval()` / `eval_async()` methods to the function, so that you can directly call with specific input data. + This will add `eval()` and `eval_async()` methods to the function, so that you can directly call with specific input data.