Skip to content

Commit 7d950be

Browse files
committed
wip: bedrock implementation
1 parent 0ad73e1 commit 7d950be

File tree

22 files changed

+1994
-23
lines changed

22 files changed

+1994
-23
lines changed

Cargo.lock

Lines changed: 111 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ resolver = "2"
44
members = [
55
"llm/llm",
66
"llm/anthropic",
7+
"llm/bedrock",
78
"llm/grok",
89
"llm/ollama",
910
"llm/openai",
@@ -26,3 +27,7 @@ serde = { version = "1.0", features = ["derive"] }
2627
serde_json = { version = "1.0" }
2728
wit-bindgen-rt = { version = "0.40.0", features = ["bitflags"] }
2829
base64 = { version = "0.22.1" }
30+
hex = { version = "0.4" }
31+
hmac = { version = "0.12" }
32+
sha2 = { version = "0.10" }
33+
chrono = { version = "0.4", features = ["serde"] }

Makefile.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ script = '''
137137
138138
is_portable = eq ${1} "--portable"
139139
140-
targets = array llm_openai llm_anthropic llm_grok llm_openrouter llm_ollama
140+
targets = array llm_openai llm_anthropic llm_grok llm_openrouter llm_ollama llm_bedrock
141141
for target in ${targets}
142142
if is_portable
143143
cp target/wasm32-wasip1/debug/golem_${target}.wasm components/debug/golem_${target}-portable.wasm
@@ -153,7 +153,7 @@ script = '''
153153
154154
is_portable = eq ${1} "--portable"
155155
156-
targets = array llm_openai llm_anthropic llm_grok llm_openrouter llm_ollama
156+
targets = array llm_openai llm_anthropic llm_grok llm_openrouter llm_ollama llm_bedrock
157157
for target in ${targets}
158158
if is_portable
159159
cp target/wasm32-wasip1/release/golem_${target}.wasm components/release/golem_${target}-portable.wasm

llm/Makefile.toml

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ skip_core_tasks = true
55
[tasks.build]
66
run_task = { name = [
77
"build-anthropic",
8+
"build-bedrock",
89
"build-grok",
910
"build-openai",
1011
"build-openrouter",
@@ -14,6 +15,7 @@ run_task = { name = [
1415
[tasks.build-portable]
1516
run_task = { name = [
1617
"build-anthropic-portable",
18+
"build-bedrock-portable",
1719
"build-grok-portable",
1820
"build-openai-portable",
1921
"build-openrouter-portable",
@@ -23,6 +25,7 @@ run_task = { name = [
2325
[tasks.release-build]
2426
run_task = { name = [
2527
"release-build-anthropic",
28+
"release-build-bedrock",
2629
"release-build-grok",
2730
"release-build-openai",
2831
"release-build-openrouter",
@@ -32,6 +35,7 @@ run_task = { name = [
3235
[tasks.release-build-portable]
3336
run_task = { name = [
3437
"release-build-anthropic-portable",
38+
"release-build-bedrock-portable",
3539
"release-build-grok-portable",
3640
"release-build-openai-portable",
3741
"release-build-openrouter-portable",
@@ -60,6 +64,16 @@ install_crate = { crate_name = "cargo-component", version = "0.20.0" }
6064
command = "cargo-component"
6165
args = ["build", "-p", "golem-llm-anthropic", "--no-default-features"]
6266

67+
[tasks.build-bedrock]
68+
install_crate = { crate_name = "cargo-component", version = "0.20.0" }
69+
command = "cargo-component"
70+
args = ["build", "-p", "golem-llm-bedrock"]
71+
72+
[tasks.build-bedrock-portable]
73+
install_crate = { crate_name = "cargo-component", version = "0.20.0" }
74+
command = "cargo-component"
75+
args = ["build", "-p", "golem-llm-bedrock", "--no-default-features"]
76+
6377
[tasks.build-grok]
6478
install_crate = { crate_name = "cargo-component", version = "0.20.0" }
6579
command = "cargo-component"
@@ -117,6 +131,22 @@ args = [
117131
"--no-default-features",
118132
]
119133

134+
[tasks.release-build-bedrock]
135+
install_crate = { crate_name = "cargo-component", version = "0.20.0" }
136+
command = "cargo-component"
137+
args = ["build", "-p", "golem-llm-bedrock", "--release"]
138+
139+
[tasks.release-build-bedrock-portable]
140+
install_crate = { crate_name = "cargo-component", version = "0.20.0" }
141+
command = "cargo-component"
142+
args = [
143+
"build",
144+
"-p",
145+
"golem-llm-bedrock",
146+
"--release",
147+
"--no-default-features",
148+
]
149+
120150
[tasks.release-build-grok]
121151
install_crate = { crate_name = "cargo-component", version = "0.20.0" }
122152
command = "cargo-component"
@@ -163,7 +193,7 @@ dependencies = ["wit-update"]
163193

164194
script_runner = "@duckscript"
165195
script = """
166-
modules = array llm openai anthropic grok openrouter ollama
196+
modules = array llm openai anthropic bedrock grok openrouter ollama
167197
168198
for module in ${modules}
169199
rm -r ${module}/wit/deps

llm/anthropic/src/bindings.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
1-
// Generated by `wit-bindgen` 0.36.0. DO NOT EDIT!
1+
// Generated by `wit-bindgen` 0.41.0. DO NOT EDIT!
22
// Options used:
33
// * runtime_path: "wit_bindgen_rt"
44
// * with "golem:llm/llm@1.0.0" = "golem_llm::golem::llm::llm"
55
// * generate_unused_types
66
use golem_llm::golem::llm::llm as __with_name0;
77
#[cfg(target_arch = "wasm32")]
8-
#[link_section = "component-type:wit-bindgen:0.36.0:golem:llm-anthropic@1.0.0:llm-library:encoded world"]
8+
#[unsafe(
9+
link_section = "component-type:wit-bindgen:0.41.0:golem:llm-anthropic@1.0.0:llm-library:encoded world"
10+
)]
911
#[doc(hidden)]
12+
#[allow(clippy::octal_escapes)]
1013
pub static __WIT_BINDGEN_COMPONENT_TYPE: [u8; 1762] = *b"\
1114
\0asm\x0d\0\x01\0\0\x19\x16wit-component-encoding\x04\0\x07\xe0\x0c\x01A\x02\x01\
1215
A\x02\x01BO\x01m\x04\x04user\x09assistant\x06system\x04tool\x04\0\x04role\x03\0\0\
@@ -43,8 +46,8 @@ ng-get-next\x01B\x01p\x15\x01@\x02\x08messages\xc3\0\x06config)\06\x04\0\x04send
4346
\0\x06config)\06\x04\0\x08continue\x01G\x01i=\x01@\x02\x08messages\xc3\0\x06conf\
4447
ig)\0\xc8\0\x04\0\x06stream\x01I\x04\0\x13golem:llm/llm@1.0.0\x05\0\x04\0%golem:\
4548
llm-anthropic/llm-library@1.0.0\x04\0\x0b\x11\x01\0\x0bllm-library\x03\0\0\0G\x09\
46-
producers\x01\x0cprocessed-by\x02\x0dwit-component\x070.220.0\x10wit-bindgen-rus\
47-
t\x060.36.0";
49+
producers\x01\x0cprocessed-by\x02\x0dwit-component\x070.227.1\x10wit-bindgen-rus\
50+
t\x060.41.0";
4851
#[inline(never)]
4952
#[doc(hidden)]
5053
pub fn __link_custom_section_describing_imports() {

llm/bedrock/Cargo.toml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
[package]
2+
name = "golem-llm-bedrock"
3+
version = "0.0.0"
4+
edition = "2021"
5+
license = "Apache-2.0"
6+
homepage = "https://golem.cloud"
7+
repository = "https://github.com/golemcloud/golem-llm"
8+
description = "WebAssembly component for working with AWS Bedrock APIs, with special support for Golem Cloud"
9+
10+
[lib]
11+
path = "src/lib.rs"
12+
crate-type = ["cdylib"]
13+
14+
[features]
15+
default = ["durability"]
16+
durability = ["golem-rust/durability", "golem-llm/durability"]
17+
18+
[dependencies]
19+
golem-llm = { workspace = true }
20+
21+
golem-rust = { workspace = true }
22+
log = { workspace = true }
23+
reqwest = { workspace = true }
24+
serde = { workspace = true }
25+
serde_json = { workspace = true }
26+
wit-bindgen-rt = { workspace = true }
27+
base64 = { workspace = true }
28+
hex = { workspace = true }
29+
hmac = { workspace = true }
30+
sha2 = { workspace = true }
31+
chrono = { workspace = true }
32+
33+
[package.metadata.component]
34+
package = "golem:llm-bedrock"
35+
36+
[package.metadata.component.bindings]
37+
generate_unused_types = true
38+
39+
[package.metadata.component.bindings.with]
40+
"golem:llm/llm@1.0.0" = "golem_llm::golem::llm::llm"
41+
42+
[package.metadata.component.target]
43+
path = "wit"
44+
45+
[package.metadata.component.target.dependencies]
46+
"golem:llm" = { path = "wit/deps/golem-llm" }
47+
"wasi:io" = { path = "wit/deps/wasi:io" }

0 commit comments

Comments
 (0)