Skip to content

feat: Durable web search golem:web-search API across multiple providers in Rust #60

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
1 change: 1 addition & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: CI


on:
push:
tags:
Expand Down
97 changes: 97 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ members = [
"llm/ollama",
"llm/openai",
"llm/openrouter",
"websearch/websearch",
"websearch/brave",
"websearch/google",
"websearch/serper",
"websearch/tavily",
]

[profile.release]
Expand Down
44 changes: 33 additions & 11 deletions Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ args = ["test"]
[tasks.build]
script_runner = "@duckscript"
script = '''
domains = array llm
domains = array llm websearch

# if there is no domain passed run for every domain
if is_empty ${1}
Expand All @@ -28,7 +28,7 @@ end
[tasks.release-build]
script_runner = "@duckscript"
script = '''
domains = array llm
domains = array llm websearch

# if there is no domain passed run for every domain
if is_empty ${1}
Expand All @@ -44,7 +44,7 @@ end
script_runner = "@duckscript"
script = '''
#!/bin/bash
domains = array llm
domains = array llm websearch

# if there is no domain passed run for every domain
if is_empty ${1}
Expand All @@ -60,7 +60,7 @@ end
script_runner = "@duckscript"
script = '''
#!/bin/bash
domains = array llm
domains = array llm websearch

# if there is no domain passed run for every domain
if is_empty ${1}
Expand All @@ -75,7 +75,7 @@ end
[tasks.wit]
script_runner = "@duckscript"
script = '''
domains = array llm
domains = array llm websearch

# if there is no domain passed run for every domain
if is_empty ${1}
Expand All @@ -91,7 +91,7 @@ end
description = "Builds all test components with golem-cli"
script_runner = "@duckscript"
script = '''
domains = array llm
domains = array llm websearch

# if there is no domain passed run for every domain
if is_empty ${1}
Expand Down Expand Up @@ -137,8 +137,19 @@ script = '''

is_portable = eq ${1} "--portable"

targets = array llm_openai llm_anthropic llm_grok llm_openrouter llm_ollama
for target in ${targets}
# LLM targets
llm_targets = array llm_openai llm_anthropic llm_grok llm_openrouter llm_ollama
for target in ${llm_targets}
if is_portable
cp target/wasm32-wasip1/debug/golem_${target}.wasm components/debug/golem_${target}-portable.wasm
else
cp target/wasm32-wasip1/debug/golem_${target}.wasm components/debug/golem_${target}.wasm
end
end

# WebSearch targets - use correct target names that match the actual WASM files
websearch_targets = array web_search_brave web_search_google web_search_serper web_search_tavily
for target in ${websearch_targets}
if is_portable
cp target/wasm32-wasip1/debug/golem_${target}.wasm components/debug/golem_${target}-portable.wasm
else
Expand All @@ -153,8 +164,19 @@ script = '''

is_portable = eq ${1} "--portable"

targets = array llm_openai llm_anthropic llm_grok llm_openrouter llm_ollama
for target in ${targets}
# LLM targets
llm_targets = array llm_openai llm_anthropic llm_grok llm_openrouter llm_ollama
for target in ${llm_targets}
if is_portable
cp target/wasm32-wasip1/release/golem_${target}.wasm components/release/golem_${target}-portable.wasm
else
cp target/wasm32-wasip1/release/golem_${target}.wasm components/release/golem_${target}.wasm
end
end

# WebSearch targets
websearch_targets = array websearch_brave websearch_google websearch_serper websearch_tavily
for target in ${websearch_targets}
if is_portable
cp target/wasm32-wasip1/release/golem_${target}.wasm components/release/golem_${target}-portable.wasm
else
Expand Down Expand Up @@ -229,4 +251,4 @@ foreach ($file in $cargoFiles)
Foreach-Object { $_ -replace "0.0.0", $Env:VERSION } |
Set-Content $file.PSPath
}
'''
'''
11 changes: 7 additions & 4 deletions llm/anthropic/src/bindings.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
// Generated by `wit-bindgen` 0.36.0. DO NOT EDIT!
// Generated by `wit-bindgen` 0.41.0. DO NOT EDIT!
// Options used:
// * runtime_path: "wit_bindgen_rt"
// * with "golem:llm/llm@1.0.0" = "golem_llm::golem::llm::llm"
// * generate_unused_types
use golem_llm::golem::llm::llm as __with_name0;
#[cfg(target_arch = "wasm32")]
#[link_section = "component-type:wit-bindgen:0.36.0:golem:llm-anthropic@1.0.0:llm-library:encoded world"]
#[unsafe(
link_section = "component-type:wit-bindgen:0.41.0:golem:llm-anthropic@1.0.0:llm-library:encoded world"
)]
#[doc(hidden)]
#[allow(clippy::octal_escapes)]
pub static __WIT_BINDGEN_COMPONENT_TYPE: [u8; 1762] = *b"\
\0asm\x0d\0\x01\0\0\x19\x16wit-component-encoding\x04\0\x07\xe0\x0c\x01A\x02\x01\
A\x02\x01BO\x01m\x04\x04user\x09assistant\x06system\x04tool\x04\0\x04role\x03\0\0\
Expand Down Expand Up @@ -43,8 +46,8 @@ ng-get-next\x01B\x01p\x15\x01@\x02\x08messages\xc3\0\x06config)\06\x04\0\x04send
\0\x06config)\06\x04\0\x08continue\x01G\x01i=\x01@\x02\x08messages\xc3\0\x06conf\
ig)\0\xc8\0\x04\0\x06stream\x01I\x04\0\x13golem:llm/llm@1.0.0\x05\0\x04\0%golem:\
llm-anthropic/llm-library@1.0.0\x04\0\x0b\x11\x01\0\x0bllm-library\x03\0\0\0G\x09\
producers\x01\x0cprocessed-by\x02\x0dwit-component\x070.220.0\x10wit-bindgen-rus\
t\x060.36.0";
producers\x01\x0cprocessed-by\x02\x0dwit-component\x070.227.1\x10wit-bindgen-rus\
t\x060.41.0";
#[inline(never)]
#[doc(hidden)]
pub fn __link_custom_section_describing_imports() {
Expand Down
11 changes: 7 additions & 4 deletions llm/grok/src/bindings.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
// Generated by `wit-bindgen` 0.36.0. DO NOT EDIT!
// Generated by `wit-bindgen` 0.41.0. DO NOT EDIT!
// Options used:
// * runtime_path: "wit_bindgen_rt"
// * with "golem:llm/llm@1.0.0" = "golem_llm::golem::llm::llm"
// * generate_unused_types
use golem_llm::golem::llm::llm as __with_name0;
#[cfg(target_arch = "wasm32")]
#[link_section = "component-type:wit-bindgen:0.36.0:golem:llm-grok@1.0.0:llm-library:encoded world"]
#[unsafe(
link_section = "component-type:wit-bindgen:0.41.0:golem:llm-grok@1.0.0:llm-library:encoded world"
)]
#[doc(hidden)]
#[allow(clippy::octal_escapes)]
pub static __WIT_BINDGEN_COMPONENT_TYPE: [u8; 1757] = *b"\
\0asm\x0d\0\x01\0\0\x19\x16wit-component-encoding\x04\0\x07\xdb\x0c\x01A\x02\x01\
A\x02\x01BO\x01m\x04\x04user\x09assistant\x06system\x04tool\x04\0\x04role\x03\0\0\
Expand Down Expand Up @@ -43,8 +46,8 @@ ng-get-next\x01B\x01p\x15\x01@\x02\x08messages\xc3\0\x06config)\06\x04\0\x04send
\0\x06config)\06\x04\0\x08continue\x01G\x01i=\x01@\x02\x08messages\xc3\0\x06conf\
ig)\0\xc8\0\x04\0\x06stream\x01I\x04\0\x13golem:llm/llm@1.0.0\x05\0\x04\0\x20gol\
em:llm-grok/llm-library@1.0.0\x04\0\x0b\x11\x01\0\x0bllm-library\x03\0\0\0G\x09p\
roducers\x01\x0cprocessed-by\x02\x0dwit-component\x070.220.0\x10wit-bindgen-rust\
\x060.36.0";
roducers\x01\x0cprocessed-by\x02\x0dwit-component\x070.227.1\x10wit-bindgen-rust\
\x060.41.0";
#[inline(never)]
#[doc(hidden)]
pub fn __link_custom_section_describing_imports() {
Expand Down
11 changes: 7 additions & 4 deletions llm/ollama/src/bindings.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
// Generated by `wit-bindgen` 0.36.0. DO NOT EDIT!
// Generated by `wit-bindgen` 0.41.0. DO NOT EDIT!
// Options used:
// * runtime_path: "wit_bindgen_rt"
// * with "golem:llm/llm@1.0.0" = "golem_llm::golem::llm::llm"
// * generate_unused_types
use golem_llm::golem::llm::llm as __with_name0;
#[cfg(target_arch = "wasm32")]
#[link_section = "component-type:wit-bindgen:0.36.0:golem:llm-ollama@1.0.0:llm-library:encoded world"]
#[unsafe(
link_section = "component-type:wit-bindgen:0.41.0:golem:llm-ollama@1.0.0:llm-library:encoded world"
)]
#[doc(hidden)]
#[allow(clippy::octal_escapes)]
pub static __WIT_BINDGEN_COMPONENT_TYPE: [u8; 1759] = *b"\
\0asm\x0d\0\x01\0\0\x19\x16wit-component-encoding\x04\0\x07\xdd\x0c\x01A\x02\x01\
A\x02\x01BO\x01m\x04\x04user\x09assistant\x06system\x04tool\x04\0\x04role\x03\0\0\
Expand Down Expand Up @@ -43,8 +46,8 @@ ng-get-next\x01B\x01p\x15\x01@\x02\x08messages\xc3\0\x06config)\06\x04\0\x04send
\0\x06config)\06\x04\0\x08continue\x01G\x01i=\x01@\x02\x08messages\xc3\0\x06conf\
ig)\0\xc8\0\x04\0\x06stream\x01I\x04\0\x13golem:llm/llm@1.0.0\x05\0\x04\0\"golem\
:llm-ollama/llm-library@1.0.0\x04\0\x0b\x11\x01\0\x0bllm-library\x03\0\0\0G\x09p\
roducers\x01\x0cprocessed-by\x02\x0dwit-component\x070.220.0\x10wit-bindgen-rust\
\x060.36.0";
roducers\x01\x0cprocessed-by\x02\x0dwit-component\x070.227.1\x10wit-bindgen-rust\
\x060.41.0";
#[inline(never)]
#[doc(hidden)]
pub fn __link_custom_section_describing_imports() {
Expand Down
11 changes: 7 additions & 4 deletions llm/openai/src/bindings.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
// Generated by `wit-bindgen` 0.36.0. DO NOT EDIT!
// Generated by `wit-bindgen` 0.41.0. DO NOT EDIT!
// Options used:
// * runtime_path: "wit_bindgen_rt"
// * with "golem:llm/llm@1.0.0" = "golem_llm::golem::llm::llm"
// * generate_unused_types
use golem_llm::golem::llm::llm as __with_name0;
#[cfg(target_arch = "wasm32")]
#[link_section = "component-type:wit-bindgen:0.36.0:golem:llm-openai@1.0.0:llm-library:encoded world"]
#[unsafe(
link_section = "component-type:wit-bindgen:0.41.0:golem:llm-openai@1.0.0:llm-library:encoded world"
)]
#[doc(hidden)]
#[allow(clippy::octal_escapes)]
pub static __WIT_BINDGEN_COMPONENT_TYPE: [u8; 1759] = *b"\
\0asm\x0d\0\x01\0\0\x19\x16wit-component-encoding\x04\0\x07\xdd\x0c\x01A\x02\x01\
A\x02\x01BO\x01m\x04\x04user\x09assistant\x06system\x04tool\x04\0\x04role\x03\0\0\
Expand Down Expand Up @@ -43,8 +46,8 @@ ng-get-next\x01B\x01p\x15\x01@\x02\x08messages\xc3\0\x06config)\06\x04\0\x04send
\0\x06config)\06\x04\0\x08continue\x01G\x01i=\x01@\x02\x08messages\xc3\0\x06conf\
ig)\0\xc8\0\x04\0\x06stream\x01I\x04\0\x13golem:llm/llm@1.0.0\x05\0\x04\0\"golem\
:llm-openai/llm-library@1.0.0\x04\0\x0b\x11\x01\0\x0bllm-library\x03\0\0\0G\x09p\
roducers\x01\x0cprocessed-by\x02\x0dwit-component\x070.220.0\x10wit-bindgen-rust\
\x060.36.0";
roducers\x01\x0cprocessed-by\x02\x0dwit-component\x070.227.1\x10wit-bindgen-rust\
\x060.41.0";
#[inline(never)]
#[doc(hidden)]
pub fn __link_custom_section_describing_imports() {
Expand Down
11 changes: 7 additions & 4 deletions llm/openrouter/src/bindings.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
// Generated by `wit-bindgen` 0.36.0. DO NOT EDIT!
// Generated by `wit-bindgen` 0.41.0. DO NOT EDIT!
// Options used:
// * runtime_path: "wit_bindgen_rt"
// * with "golem:llm/llm@1.0.0" = "golem_llm::golem::llm::llm"
// * generate_unused_types
use golem_llm::golem::llm::llm as __with_name0;
#[cfg(target_arch = "wasm32")]
#[link_section = "component-type:wit-bindgen:0.36.0:golem:llm-openrouter@1.0.0:llm-library:encoded world"]
#[unsafe(
link_section = "component-type:wit-bindgen:0.41.0:golem:llm-openrouter@1.0.0:llm-library:encoded world"
)]
#[doc(hidden)]
#[allow(clippy::octal_escapes)]
pub static __WIT_BINDGEN_COMPONENT_TYPE: [u8; 1763] = *b"\
\0asm\x0d\0\x01\0\0\x19\x16wit-component-encoding\x04\0\x07\xe1\x0c\x01A\x02\x01\
A\x02\x01BO\x01m\x04\x04user\x09assistant\x06system\x04tool\x04\0\x04role\x03\0\0\
Expand Down Expand Up @@ -43,8 +46,8 @@ ng-get-next\x01B\x01p\x15\x01@\x02\x08messages\xc3\0\x06config)\06\x04\0\x04send
\0\x06config)\06\x04\0\x08continue\x01G\x01i=\x01@\x02\x08messages\xc3\0\x06conf\
ig)\0\xc8\0\x04\0\x06stream\x01I\x04\0\x13golem:llm/llm@1.0.0\x05\0\x04\0&golem:\
llm-openrouter/llm-library@1.0.0\x04\0\x0b\x11\x01\0\x0bllm-library\x03\0\0\0G\x09\
producers\x01\x0cprocessed-by\x02\x0dwit-component\x070.220.0\x10wit-bindgen-rus\
t\x060.36.0";
producers\x01\x0cprocessed-by\x02\x0dwit-component\x070.227.1\x10wit-bindgen-rus\
t\x060.41.0";
#[inline(never)]
#[doc(hidden)]
pub fn __link_custom_section_describing_imports() {
Expand Down
12 changes: 12 additions & 0 deletions test/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading