Skip to content

Commit 32868b0

Browse files
committed
feat: refine feature flag exclusion, to avoid IDE errors
1 parent 4ee8617 commit 32868b0

File tree

9 files changed

+32
-33
lines changed

9 files changed

+32
-33
lines changed

llm-anthropic/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ 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]
1919
golem-llm = { workspace = true }

llm-bedrock/Cargo.toml

Lines changed: 3 additions & 7 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 = { workspace = true }
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 }
@@ -38,11 +38,7 @@ path = "src/lib.rs"
3838

3939
[features]
4040
default = ["durability"]
41-
durability = [
42-
"golem-rust/durability",
43-
"golem-llm/durability",
44-
"golem-llm/nopoll",
45-
]
41+
durability = ["golem-rust/durability", "golem-llm/durability"]
4642

4743
[package.metadata.component]
4844
package = "golem:llm-bedrock"

llm-bedrock/src/lib.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ impl ExtendedGuest for BedrockComponent {
6262

6363
bedrock.unwrap().converse_stream(messages, config)
6464
}
65+
66+
fn subscribe(_stream: &Self::ChatStream) -> golem_rust::wasm_rpc::Pollable {
67+
unimplemented!()
68+
}
6569
}
6670

6771
type DurableBedrockComponent = DurableLLM<BedrockComponent>;

llm-grok/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ 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]
1919
golem-llm = { workspace = true }

llm-ollama/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ 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]
2020
golem-llm = { workspace = true }

llm-openai/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ 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]
1919
golem-llm = { workspace = true }

llm-openrouter/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ 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]
1919
golem-llm = { workspace = true }

llm/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ wit-bindgen = { version = "0.40.0" }
2424
[features]
2525
default = ["durability"]
2626
durability = ["golem-rust/durability"]
27-
nopoll = []
27+
poll = []

llm/src/durability.rs

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use crate::golem::llm::llm::{Config, ContentPart, Guest, Message, Role, StreamDelta};
2-
#[cfg(not(feature = "nopoll"))]
32
use golem_rust::wasm_rpc::Pollable;
43
use std::marker::PhantomData;
54

@@ -58,7 +57,7 @@ pub trait ExtendedGuest: Guest + 'static {
5857
});
5958
extended_messages
6059
}
61-
#[cfg(not(feature = "nopoll"))]
60+
6261
fn subscribe(stream: &Self::ChatStream) -> Pollable;
6362
}
6463

@@ -107,7 +106,7 @@ mod durable_impl {
107106
ToolCall, ToolResult,
108107
};
109108
use golem_rust::bindings::golem::durability::durability::DurableFunctionType;
110-
#[cfg(not(feature = "nopoll"))]
109+
#[cfg(feature = "poll")]
111110
use golem_rust::bindings::golem::durability::durability::LazyInitializedPollable;
112111
use golem_rust::durability::Durability;
113112
use golem_rust::wasm_rpc::Pollable;
@@ -198,13 +197,13 @@ mod durable_impl {
198197
enum DurableChatStreamState<Impl: ExtendedGuest> {
199198
Live {
200199
stream: Impl::ChatStream,
201-
#[cfg(not(feature = "nopoll"))]
200+
#[cfg(feature = "poll")]
202201
pollables: Vec<LazyInitializedPollable>,
203202
},
204203
Replay {
205204
original_messages: Vec<Message>,
206205
config: Config,
207-
#[cfg(not(feature = "nopoll"))]
206+
#[cfg(feature = "poll")]
208207
pollables: Vec<LazyInitializedPollable>,
209208
partial_result: Vec<StreamDelta>,
210209
finished: bool,
@@ -221,7 +220,7 @@ mod durable_impl {
221220
Self {
222221
state: RefCell::new(Some(DurableChatStreamState::Live {
223222
stream,
224-
#[cfg(not(feature = "nopoll"))]
223+
#[cfg(feature = "poll")]
225224
pollables: Vec::new(),
226225
})),
227226
subscription: RefCell::new(None),
@@ -233,15 +232,15 @@ mod durable_impl {
233232
state: RefCell::new(Some(DurableChatStreamState::Replay {
234233
original_messages,
235234
config,
236-
#[cfg(not(feature = "nopoll"))]
235+
#[cfg(feature = "poll")]
237236
pollables: Vec::new(),
238237
partial_result: Vec::new(),
239238
finished: false,
240239
})),
241240
subscription: RefCell::new(None),
242241
}
243242
}
244-
#[cfg(not(feature = "nopoll"))]
243+
#[cfg(feature = "poll")]
245244
fn subscribe(&self) -> Pollable {
246245
let mut state = self.state.borrow_mut();
247246
match &mut *state {
@@ -265,22 +264,22 @@ mod durable_impl {
265264

266265
match self.state.take() {
267266
Some(DurableChatStreamState::Live {
268-
#[cfg(not(feature = "nopoll"))]
267+
#[cfg(feature = "poll")]
269268
mut pollables,
270269
stream,
271270
}) => {
272271
with_persistence_level(PersistenceLevel::PersistNothing, move || {
273-
#[cfg(not(feature = "nopoll"))]
272+
#[cfg(feature = "poll")]
274273
pollables.clear();
275274
drop(stream);
276275
});
277276
}
278277
Some(DurableChatStreamState::Replay {
279-
#[cfg(not(feature = "nopoll"))]
278+
#[cfg(feature = "poll")]
280279
mut pollables,
281280
..
282281
}) => {
283-
#[cfg(not(feature = "nopoll"))]
282+
#[cfg(feature = "poll")]
284283
pollables.clear();
285284
}
286285
None => {}
@@ -308,7 +307,7 @@ mod durable_impl {
308307
Some(DurableChatStreamState::Replay {
309308
original_messages,
310309
config,
311-
#[cfg(not(feature = "nopoll"))]
310+
#[cfg(feature = "poll")]
312311
pollables,
313312
partial_result,
314313
finished,
@@ -325,7 +324,7 @@ mod durable_impl {
325324
extended_messages,
326325
config.clone(),
327326
);
328-
#[cfg(not(feature = "nopoll"))]
327+
#[cfg(feature = "poll")]
329328
for lazy_initialized_pollable in pollables {
330329
lazy_initialized_pollable.set(Impl::subscribe(&stream));
331330
}
@@ -344,7 +343,7 @@ mod durable_impl {
344343
};
345344

346345
if let Some(stream) = new_live_stream {
347-
#[cfg(not(feature = "nopoll"))]
346+
#[cfg(feature = "poll")]
348347
let pollables = match state.take() {
349348
Some(DurableChatStreamState::Live { pollables, .. }) => pollables,
350349
Some(DurableChatStreamState::Replay { pollables, .. }) => pollables,
@@ -354,7 +353,7 @@ mod durable_impl {
354353
};
355354
*state = Some(DurableChatStreamState::Live {
356355
stream,
357-
#[cfg(not(feature = "nopoll"))]
356+
#[cfg(feature = "poll")]
358357
pollables,
359358
});
360359
}
@@ -397,17 +396,17 @@ mod durable_impl {
397396
}
398397

399398
fn blocking_get_next(&self) -> Vec<StreamEvent> {
400-
#[cfg(not(feature = "nopoll"))]
399+
#[cfg(feature = "poll")]
401400
let mut subscription = self.subscription.borrow_mut();
402-
#[cfg(not(feature = "nopoll"))]
401+
#[cfg(feature = "poll")]
403402
if subscription.is_none() {
404403
*subscription = Some(self.subscribe());
405404
}
406-
#[cfg(not(feature = "nopoll"))]
405+
#[cfg(feature = "poll")]
407406
let subscription = subscription.as_mut().unwrap();
408407
let mut result = Vec::new();
409408
loop {
410-
#[cfg(not(feature = "nopoll"))]
409+
#[cfg(feature = "poll")]
411410
subscription.block();
412411
match self.get_next() {
413412
Some(events) => {

0 commit comments

Comments
 (0)