Skip to content

Commit 7e76583

Browse files
committed
fixes
1 parent 796d7d7 commit 7e76583

File tree

6 files changed

+153
-15
lines changed

6 files changed

+153
-15
lines changed

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 embed_openai embed_cohere embed_hugging_face embed_voyageai
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 embed_openai embed_cohere embed_hugging_face embed_voyageai
157157
for target in ${targets}
158158
if is_portable
159159
cp target/wasm32-wasip1/release/golem_${target}.wasm components/release/golem_${target}-portable.wasm

embed/Makefile.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ dependencies = ["wit-update"]
124124

125125
script_runner = "@duckscript"
126126
script = """
127-
modules = array embed embed-openai embed-cohere embed-hugging-face embed-voyageai
127+
modules = array embed openai cohere hugging-face voyageai
128128
129129
for module in ${modules}
130130
rm -r ${module}/wit/deps

llm/ollama/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-ollama@1.0.0:llm-library:encoded world"]
8+
#[unsafe(
9+
link_section = "component-type:wit-bindgen:0.41.0:golem:llm-ollama@1.0.0:llm-library:encoded world"
10+
)]
911
#[doc(hidden)]
12+
#[allow(clippy::octal_escapes)]
1013
pub static __WIT_BINDGEN_COMPONENT_TYPE: [u8; 1759] = *b"\
1114
\0asm\x0d\0\x01\0\0\x19\x16wit-component-encoding\x04\0\x07\xdd\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-ollama/llm-library@1.0.0\x04\0\x0b\x11\x01\0\x0bllm-library\x03\0\0\0G\x09p\
46-
roducers\x01\x0cprocessed-by\x02\x0dwit-component\x070.220.0\x10wit-bindgen-rust\
47-
\x060.36.0";
49+
roducers\x01\x0cprocessed-by\x02\x0dwit-component\x070.227.1\x10wit-bindgen-rust\
50+
\x060.41.0";
4851
#[inline(never)]
4952
#[doc(hidden)]
5053
pub fn __link_custom_section_describing_imports() {

llm/openai/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-openai@1.0.0:llm-library:encoded world"]
8+
#[unsafe(
9+
link_section = "component-type:wit-bindgen:0.41.0:golem:llm-openai@1.0.0:llm-library:encoded world"
10+
)]
911
#[doc(hidden)]
12+
#[allow(clippy::octal_escapes)]
1013
pub static __WIT_BINDGEN_COMPONENT_TYPE: [u8; 1759] = *b"\
1114
\0asm\x0d\0\x01\0\0\x19\x16wit-component-encoding\x04\0\x07\xdd\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-openai/llm-library@1.0.0\x04\0\x0b\x11\x01\0\x0bllm-library\x03\0\0\0G\x09p\
46-
roducers\x01\x0cprocessed-by\x02\x0dwit-component\x070.220.0\x10wit-bindgen-rust\
47-
\x060.36.0";
49+
roducers\x01\x0cprocessed-by\x02\x0dwit-component\x070.227.1\x10wit-bindgen-rust\
50+
\x060.41.0";
4851
#[inline(never)]
4952
#[doc(hidden)]
5053
pub fn __link_custom_section_describing_imports() {

llm/openrouter/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-openrouter@1.0.0:llm-library:encoded world"]
8+
#[unsafe(
9+
link_section = "component-type:wit-bindgen:0.41.0:golem:llm-openrouter@1.0.0:llm-library:encoded world"
10+
)]
911
#[doc(hidden)]
12+
#[allow(clippy::octal_escapes)]
1013
pub static __WIT_BINDGEN_COMPONENT_TYPE: [u8; 1763] = *b"\
1114
\0asm\x0d\0\x01\0\0\x19\x16wit-component-encoding\x04\0\x07\xe1\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-openrouter/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() {
Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
package golem:embed@1.0.0;
2+
3+
interface embed {
4+
// --- Enums ---
5+
6+
enum task-type {
7+
retrieval-query,
8+
retrieval-document,
9+
semantic-similarity,
10+
classification,
11+
clustering,
12+
question-answering,
13+
fact-verification,
14+
code-retrieval,
15+
}
16+
17+
enum output-format {
18+
float-array,
19+
binary,
20+
base64,
21+
}
22+
23+
enum output-dtype {
24+
float-array,
25+
int8,
26+
uint8,
27+
binary,
28+
ubinary,
29+
}
30+
31+
enum error-code {
32+
invalid-request,
33+
model-not-found,
34+
unsupported,
35+
authentication-failed,
36+
provider-error,
37+
rate-limit-exceeded,
38+
internal-error,
39+
unknown,
40+
}
41+
42+
// --- Content ---
43+
44+
record image-url {
45+
url: string,
46+
}
47+
48+
variant content-part {
49+
text(string),
50+
image(image-url),
51+
}
52+
53+
// --- Configuration ---
54+
55+
record kv {
56+
key: string,
57+
value: string,
58+
}
59+
60+
record config {
61+
model: option<string>,
62+
task-type: option<task-type>,
63+
dimensions: option<u32>,
64+
truncation: option<bool>,
65+
output-format: option<output-format>,
66+
output-dtype: option<output-dtype>,
67+
user: option<string>,
68+
provider-options: list<kv>,
69+
}
70+
71+
// --- Embedding Response ---
72+
73+
record usage {
74+
input-tokens: option<u32>,
75+
total-tokens: option<u32>,
76+
}
77+
78+
record embedding {
79+
index: u32,
80+
vector: list<f32>,
81+
}
82+
83+
record embedding-response {
84+
embeddings: list<embedding>,
85+
usage: option<usage>,
86+
model: string,
87+
provider-metadata-json: option<string>,
88+
}
89+
90+
// --- Rerank Response ---
91+
92+
record rerank-result {
93+
index: u32,
94+
relevance-score: f32,
95+
document: option<string>,
96+
}
97+
98+
record rerank-response {
99+
results: list<rerank-result>,
100+
usage: option<usage>,
101+
model: string,
102+
provider-metadata-json: option<string>,
103+
}
104+
105+
// --- Error Handling ---
106+
107+
record error {
108+
code: error-code,
109+
message: string,
110+
provider-error-json: option<string>,
111+
}
112+
113+
// --- Core Functions ---
114+
115+
generate: func(
116+
inputs: list<content-part>,
117+
config: config
118+
) -> result<embedding-response, error>;
119+
120+
rerank: func(
121+
query: string,
122+
documents: list<string>,
123+
config: config
124+
) -> result<rerank-response, error>;
125+
}
126+
127+
world embed-library {
128+
export embed;
129+
}

0 commit comments

Comments
 (0)