Skip to content
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
2 changes: 1 addition & 1 deletion docs/docs/ai/llm.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ It has the following fields:

Embedding means converting text into a vector space, usually for similarity matching.

We provide a builtin function [`EmbedText`](/docs/ops/functions#embedtext) that converts a given text into a vector space.
We provide a builtin function [`EmbedText`](/docs/ops/functions#embedtext) that converts a given text into a vector space.
The spec takes the following fields:

* `api_type` (type: `cocoindex.LlmApiType`, required)
Expand Down
1 change: 0 additions & 1 deletion docs/docs/ops/functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,4 +133,3 @@ Input data:
* `text` (type: `str`, required): The text to embed.

Return type: `vector[float32; N]`, where `N` is the dimension of the embedding vector determined by the model.

2 changes: 1 addition & 1 deletion docs/sidebars.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,4 @@ const sidebars: SidebarsConfig = {
],
};

export default sidebars;
export default sidebars;
16 changes: 10 additions & 6 deletions src/builder/flow_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use crate::{prelude::*, py::Pythonized};
use pyo3::{exceptions::PyException, prelude::*};
use pyo3_async_runtimes::tokio::future_into_py;
use std::{collections::btree_map, ops::Deref};
use tokio::task::LocalSet;

use super::analyzer::{
AnalyzerContext, CollectorBuilder, DataScopeBuilder, OpScope, build_flow_instance_context,
Expand Down Expand Up @@ -622,14 +623,17 @@ impl FlowBuilder {
};
let py_ctx = crate::py::PythonExecutionContext::new(py, py_event_loop);

future_into_py(py, async move {
let analyzed_flow = tokio::task::spawn_local(
let analyzed_flow = get_runtime().spawn_blocking(|| {
let local_set = LocalSet::new();
local_set.block_on(
get_runtime(),
super::AnalyzedTransientFlow::from_transient_flow(spec, Some(py_ctx)),
)
.await
.into_py_result()?
.into_py_result()?;
Ok(py::TransientFlow(Arc::new(analyzed_flow)))
});
future_into_py(py, async move {
Ok(py::TransientFlow(Arc::new(
analyzed_flow.await.into_py_result()?.into_py_result()?,
)))
})
}

Expand Down