Skip to content

Commit 475dc7b

Browse files
committed
feat: add nopoll feature flag to remove pollable when using async runtime
1 parent d261ee9 commit 475dc7b

File tree

12 files changed

+54
-36
lines changed

12 files changed

+54
-36
lines changed

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ lto = true
1717
opt-level = 's'
1818

1919
[workspace.dependencies]
20+
golem-llm = { path = "llm", version = "0.0.0", default-features = false }
21+
2022
golem-rust = "1.6.0"
2123
log = "0.4.27"
2224
reqwest = { git = "https://github.com/golemcloud/reqwest", branch = "update-may-2025", features = [

llm-anthropic/Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ crate-type = ["cdylib"]
1313

1414
[features]
1515
default = ["durability"]
16-
durability = ["golem-rust/durability", "golem-llm/durability"]
16+
durability = ["golem-rust/durability", "golem-llm/durability", "golem-llm/poll"]
1717

1818
[dependencies]
19-
golem-llm = { path = "../llm", version = "0.0.0", default-features = false }
19+
golem-llm = { workspace = true }
2020

2121
golem-rust = { workspace = true }
2222
log = { workspace = true }
23-
reqwest = { workspace = true }
23+
reqwest = { workspace = true }
2424
serde = { workspace = true }
2525
serde_json = { workspace = true }
2626
wit-bindgen-rt = { workspace = true }
@@ -40,4 +40,4 @@ path = "wit"
4040

4141
[package.metadata.component.target.dependencies]
4242
"golem:llm" = { path = "wit/deps/golem-llm" }
43-
"wasi:io" = { path = "wit/deps/wasi:io"}
43+
"wasi:io" = { path = "wit/deps/wasi:io" }
File renamed without changes.

llm-bedrock/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ repository = "https://github.com/golemcloud/golem-llm"
88
description = "WebAssembly component for working with Amazon Bedrock APIs, with special support for Golem Cloud"
99

1010
[dependencies]
11-
golem-llm = { path = "../llm", version = "0.0.0", default-features = false }
12-
1311
# AWS SDK crates
1412
aws-config = { version = "1.5.19", default-features = false, features = [
1513
"behavior-version-latest",
@@ -24,6 +22,8 @@ tokio = { version = "1.43.0", features = ["rt", "sync", "time"] }
2422
# To infer mime types of downloaded images before passing to bedrock
2523
infer = { version = "0.19.0", default-features = false }
2624

25+
golem-llm = { workspace = true }
26+
2727
golem-rust = { workspace = true }
2828
log = { workspace = true }
2929
reqwest = { workspace = true }

llm-bedrock/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ impl ExtendedGuest for BedrockComponent {
6363
bedrock.unwrap().converse_stream(messages, config)
6464
}
6565

66-
fn subscribe(stream: &Self::ChatStream) -> golem_rust::wasm_rpc::Pollable {
67-
stream.subscribe()
66+
fn subscribe(_stream: &Self::ChatStream) -> golem_rust::wasm_rpc::Pollable {
67+
unimplemented!()
6868
}
6969
}
7070

llm-bedrock/src/stream.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ use aws_sdk_bedrockruntime::{
33
types::error::ConverseStreamOutputError,
44
};
55
use golem_llm::golem::llm::llm;
6-
use golem_rust::wasm_rpc::wasi::io::poll::Pollable;
76
use std::cell::{RefCell, RefMut};
87

98
use crate::{
@@ -52,10 +51,6 @@ impl BedrockChatStream {
5251
fn set_finished(&self) {
5352
*self.finished.borrow_mut() = true;
5453
}
55-
56-
pub fn subscribe(&self) -> Pollable {
57-
golem_rust::bindings::wasi::clocks::monotonic_clock::subscribe_duration(0)
58-
}
5954
}
6055

6156
impl llm::GuestChatStream for BedrockChatStream {
@@ -97,10 +92,8 @@ impl llm::GuestChatStream for BedrockChatStream {
9792
}
9893

9994
fn blocking_get_next(&self) -> Vec<llm::StreamEvent> {
100-
let pollable = self.subscribe();
10195
let mut result = Vec::new();
10296
loop {
103-
pollable.block();
10497
match self.get_next() {
10598
Some(events) => {
10699
result.extend(events);

llm-grok/Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ crate-type = ["cdylib"]
1313

1414
[features]
1515
default = ["durability"]
16-
durability = ["golem-rust/durability", "golem-llm/durability"]
16+
durability = ["golem-rust/durability", "golem-llm/durability", "golem-llm/poll"]
1717

1818
[dependencies]
19-
golem-llm = { path = "../llm", version = "0.0.0", default-features = false }
19+
golem-llm = { workspace = true }
2020

2121
golem-rust = { workspace = true }
2222
log = { workspace = true }
23-
reqwest = { workspace = true }
23+
reqwest = { workspace = true }
2424
serde = { workspace = true }
2525
serde_json = { workspace = true }
2626
wit-bindgen-rt = { workspace = true }
@@ -40,4 +40,4 @@ path = "wit"
4040

4141
[package.metadata.component.target.dependencies]
4242
"golem:llm" = { path = "wit/deps/golem-llm" }
43-
"wasi:io" = { path = "wit/deps/wasi:io"}
43+
"wasi:io" = { path = "wit/deps/wasi:io" }

llm-ollama/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ crate-type = ["cdylib"]
1414

1515
[features]
1616
default = ["durability"]
17-
durability = ["golem-rust/durability", "golem-llm/durability"]
17+
durability = ["golem-rust/durability", "golem-llm/durability", "golem-llm/poll"]
1818

1919
[dependencies]
20-
golem-llm = { path = "../llm", version = "0.0.0", default-features = false }
20+
golem-llm = { workspace = true }
2121
base64 = "0.21"
2222
mime_guess = "2.0"
2323
url = "2.4"

llm-openai/Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ crate-type = ["cdylib"]
1313

1414
[features]
1515
default = ["durability"]
16-
durability = ["golem-rust/durability", "golem-llm/durability"]
16+
durability = ["golem-rust/durability", "golem-llm/durability", "golem-llm/poll"]
1717

1818
[dependencies]
19-
golem-llm = { path = "../llm", version = "0.0.0", default-features = false }
19+
golem-llm = { workspace = true }
2020

2121
golem-rust = { workspace = true }
2222
log = { workspace = true }
23-
reqwest = { workspace = true }
23+
reqwest = { workspace = true }
2424
serde = { workspace = true }
2525
serde_json = { workspace = true }
2626
wit-bindgen-rt = { workspace = true }
@@ -40,4 +40,4 @@ path = "wit"
4040

4141
[package.metadata.component.target.dependencies]
4242
"golem:llm" = { path = "wit/deps/golem-llm" }
43-
"wasi:io" = { path = "wit/deps/wasi:io"}
43+
"wasi:io" = { path = "wit/deps/wasi:io" }

llm-openrouter/Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ crate-type = ["cdylib"]
1313

1414
[features]
1515
default = ["durability"]
16-
durability = ["golem-rust/durability", "golem-llm/durability"]
16+
durability = ["golem-rust/durability", "golem-llm/durability", "golem-llm/poll"]
1717

1818
[dependencies]
19-
golem-llm = { path = "../llm", version = "0.0.0", default-features = false }
19+
golem-llm = { workspace = true }
2020

2121
golem-rust = { workspace = true }
2222
log = { workspace = true }
23-
reqwest = { workspace = true }
23+
reqwest = { workspace = true }
2424
serde = { workspace = true }
2525
serde_json = { workspace = true }
2626
wit-bindgen-rt = { workspace = true }
@@ -40,4 +40,4 @@ path = "wit"
4040

4141
[package.metadata.component.target.dependencies]
4242
"golem:llm" = { path = "wit/deps/golem-llm" }
43-
"wasi:io" = { path = "wit/deps/wasi:io"}
43+
"wasi:io" = { path = "wit/deps/wasi:io" }

0 commit comments

Comments
 (0)