Skip to content

Commit

Permalink
Fix for #803
Browse files Browse the repository at this point in the history
- Fix related WASM issues
  • Loading branch information
hellovai committed Jul 19, 2024
1 parent 62085e7 commit 5313401
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions engine/baml-runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ impl BamlRuntime {
params,
self.tracer.clone(),
ctx.create_ctx(tb, cb)?,
#[cfg(not(target_arch = "wasm32"))]
self.async_runtime.clone(),
)
}
Expand Down
3 changes: 2 additions & 1 deletion engine/baml-runtime/src/runtime/runtime_interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ impl RuntimeInterface for InternalBamlRuntime {
params: &BamlMap<String, BamlValue>,
tracer: Arc<BamlTracer>,
ctx: RuntimeContext,
tokio_runtime: Arc<tokio::runtime::Runtime>,
#[cfg(not(target_arch = "wasm32"))] tokio_runtime: Arc<tokio::runtime::Runtime>,
) -> Result<FunctionResultStream> {
let func = self.get_function(&function_name, &ctx)?;
let renderer = PromptRenderer::from_function(&func, self.ir(), &ctx)?;
Expand All @@ -373,6 +373,7 @@ impl RuntimeInterface for InternalBamlRuntime {
orchestrator,
tracer,
renderer,
#[cfg(not(target_arch = "wasm32"))]
tokio_runtime,
})
}
Expand Down
2 changes: 1 addition & 1 deletion engine/baml-runtime/src/runtime_interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ pub trait RuntimeInterface {
params: &BamlMap<String, BamlValue>,
tracer: Arc<BamlTracer>,
ctx: RuntimeContext,
tokio_runtime: Arc<tokio::runtime::Runtime>,
#[cfg(not(target_arch = "wasm32"))] tokio_runtime: Arc<tokio::runtime::Runtime>,
) -> Result<FunctionResultStream>;
}

Expand Down
2 changes: 2 additions & 0 deletions engine/baml-runtime/src/types/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ pub struct FunctionResultStream {
pub(crate) ir: Arc<IntermediateRepr>,
pub(crate) orchestrator: OrchestratorNodeIterator,
pub(crate) tracer: Arc<BamlTracer>,
#[cfg(not(target_arch = "wasm32"))]
pub(crate) tokio_runtime: Arc<tokio::runtime::Runtime>,
}

Expand Down Expand Up @@ -54,6 +55,7 @@ first.scope.clone();
*/

impl FunctionResultStream {
#[cfg(not(target_arch = "wasm32"))]
pub fn run_sync<F>(
&mut self,
on_event: Option<F>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import fs from 'fs'
// import { cliBuild, cliCheckForUpdates, cliVersion } from './baml-cli'
import { type ParserDatabase, TestRequest } from '@baml/common'
import debounce from 'lodash/debounce'
import { TextDocumentIdentifier } from 'vscode-languageserver-protocol'
// import { TextDocumentIdentifier } from 'vscode-languageserver-protocol'
import { TextDocument } from 'vscode-languageserver-textdocument'
import { IPCMessageReader, IPCMessageWriter, createConnection } from 'vscode-languageserver/node'
import { z } from 'zod'
Expand Down

0 comments on commit 5313401

Please sign in to comment.