summaryrefslogtreecommitdiff
path: root/libpanto-go/README.md
diff options
context:
space:
mode:
authort <t@tjp.lol>2026-06-11 11:15:40 -0600
committert <t@tjp.lol>2026-06-11 11:15:52 -0600
commit27e37c62bc1483c0489d6db01344906472a1f8d3 (patch)
tree0c80d2c9e1fd1020e56d34d389d9c743085c2a50 /libpanto-go/README.md
parente2477f7d2d2a4eab870a2bd61534cfd146907915 (diff)
libpanto-go
some libpanto-c coverage expansion was needed
Diffstat (limited to 'libpanto-go/README.md')
-rw-r--r--libpanto-go/README.md48
1 files changed, 48 insertions, 0 deletions
diff --git a/libpanto-go/README.md b/libpanto-go/README.md
new file mode 100644
index 0000000..a19e788
--- /dev/null
+++ b/libpanto-go/README.md
@@ -0,0 +1,48 @@
+# libpanto-go
+
+Idiomatic Go bindings for `libpanto-c` via cgo.
+
+## Build
+
+Build the C ABI first:
+
+```sh
+cd ../libpanto-c
+zig build
+```
+
+Then use the Go package from this directory:
+
+```sh
+go test ./...
+```
+
+At runtime, make sure `../libpanto-c/zig-out/lib` (or the installed equivalent) is on your platform's dynamic library path.
+
+## Example
+
+```go
+panto.Init()
+defer panto.Deinit()
+
+agent, err := panto.NewAgent(panto.Config{
+ Provider: panto.ProviderConfig{
+ OpenAIChat: &panto.OpenAIChatConfig{
+ APIKey: os.Getenv("OPENAI_API_KEY"),
+ BaseURL: "https://api.openai.com/v1",
+ Model: "gpt-4.1-mini",
+ },
+ },
+})
+if err != nil { /* handle */ }
+defer agent.Close()
+
+stream, err := agent.Run("hello")
+if err != nil { /* handle */ }
+defer stream.Close()
+
+for ev := range stream.Iter() {
+ // ev.Tag identifies the active payload.
+}
+if err := stream.Err(); err != nil { /* handle */ }
+```