Skip to content

Commit c58340a

Browse files
committed
web-search crate
1 parent a06c420 commit c58340a

File tree

10 files changed

+506
-58
lines changed

10 files changed

+506
-58
lines changed

Cargo.lock

Lines changed: 14 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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[workspace]
22
resolver = "2"
33

4-
members = [ "golem-llm/llm", "golem-llm/llm-anthropic", "golem-llm/llm-grok", "golem-llm/llm-ollama", "golem-llm/llm-openai", "golem-llm/llm-openrouter"]
4+
members = [ "golem-llm/llm", "golem-llm/llm-anthropic", "golem-llm/llm-grok", "golem-llm/llm-ollama", "golem-llm/llm-openai", "golem-llm/llm-openrouter", "golem-web-search/web-search"]
55

66
[profile.release]
77
debug = false

Makefile.toml

Lines changed: 0 additions & 57 deletions
This file was deleted.

golem-web-search/wit/deps.lock

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
["wasi:io"]
2+
url = "https://github.com/WebAssembly/wasi-io/archive/v0.2.3.tar.gz"
3+
sha256 = "1cccbfe4122686ea57a25cd368e8cdfc408cbcad089f47fb6685b6f92e96f050"
4+
sha512 = "7a95f964c13da52611141acd89bc8876226497f128e99dd176a4270c5b5efbd8cc847b5fbd1a91258d028c646db99e0424d72590cf1caf20f9f3a3343fad5017"

golem-web-search/wit/deps.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"wasi:io" = "https://github.com/WebAssembly/wasi-io/archive/v0.2.3.tar.gz"
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package wasi:io@0.2.3;
2+
3+
@since(version = 0.2.0)
4+
interface error {
5+
/// A resource which represents some error information.
6+
///
7+
/// The only method provided by this resource is `to-debug-string`,
8+
/// which provides some human-readable information about the error.
9+
///
10+
/// In the `wasi:io` package, this resource is returned through the
11+
/// `wasi:io/streams/stream-error` type.
12+
///
13+
/// To provide more specific error information, other interfaces may
14+
/// offer functions to "downcast" this error into more specific types. For example,
15+
/// errors returned from streams derived from filesystem types can be described using
16+
/// the filesystem's own error-code type. This is done using the function
17+
/// `wasi:filesystem/types/filesystem-error-code`, which takes a `borrow<error>`
18+
/// parameter and returns an `option<wasi:filesystem/types/error-code>`.
19+
///
20+
/// The set of functions which can "downcast" an `error` into a more
21+
/// concrete type is open.
22+
@since(version = 0.2.0)
23+
resource error {
24+
/// Returns a string that is suitable to assist humans in debugging
25+
/// this error.
26+
///
27+
/// WARNING: The returned string should not be consumed mechanically!
28+
/// It may change across platforms, hosts, or other implementation
29+
/// details. Parsing this string is a major platform-compatibility
30+
/// hazard.
31+
@since(version = 0.2.0)
32+
to-debug-string: func() -> string;
33+
}
34+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
package wasi:io@0.2.3;
2+
3+
/// A poll API intended to let users wait for I/O events on multiple handles
4+
/// at once.
5+
@since(version = 0.2.0)
6+
interface poll {
7+
/// `pollable` represents a single I/O event which may be ready, or not.
8+
@since(version = 0.2.0)
9+
resource pollable {
10+
11+
/// Return the readiness of a pollable. This function never blocks.
12+
///
13+
/// Returns `true` when the pollable is ready, and `false` otherwise.
14+
@since(version = 0.2.0)
15+
ready: func() -> bool;
16+
17+
/// `block` returns immediately if the pollable is ready, and otherwise
18+
/// blocks until ready.
19+
///
20+
/// This function is equivalent to calling `poll.poll` on a list
21+
/// containing only this pollable.
22+
@since(version = 0.2.0)
23+
block: func();
24+
}
25+
26+
/// Poll for completion on a set of pollables.
27+
///
28+
/// This function takes a list of pollables, which identify I/O sources of
29+
/// interest, and waits until one or more of the events is ready for I/O.
30+
///
31+
/// The result `list<u32>` contains one or more indices of handles in the
32+
/// argument list that is ready for I/O.
33+
///
34+
/// This function traps if either:
35+
/// - the list is empty, or:
36+
/// - the list contains more elements than can be indexed with a `u32` value.
37+
///
38+
/// A timeout can be implemented by adding a pollable from the
39+
/// wasi-clocks API to the list.
40+
///
41+
/// This function does not return a `result`; polling in itself does not
42+
/// do any I/O so it doesn't fail. If any of the I/O sources identified by
43+
/// the pollables has an error, it is indicated by marking the source as
44+
/// being ready for I/O.
45+
@since(version = 0.2.0)
46+
poll: func(in: list<borrow<pollable>>) -> list<u32>;
47+
}

0 commit comments

Comments
 (0)