Skip to content

Commit ab503e0

Browse files
docs: update code samples from OpenAPI
1 parent cd2b6a8 commit ab503e0

1 file changed

Lines changed: 60 additions & 1 deletion

File tree

apps/invoke.mdx

Lines changed: 60 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,66 @@ You can invoke your app by making a `POST` request to Kernel's API. **For automa
99
<Info>Synchronous invocations time out after 100 seconds.</Info>
1010

1111
<CodeGroup>
12-
{{ post /invocations }}
12+
13+
```typescript Typescript
14+
import Kernel from '@onkernel/sdk';
15+
16+
const client = new Kernel({
17+
apiKey: 'My API Key',
18+
});
19+
20+
const invocation = await client.invocations.create({
21+
action_name: 'analyze',
22+
app_name: 'my-app',
23+
version: '1.0.0',
24+
});
25+
26+
console.log(invocation.id);
27+
```
28+
29+
30+
```python Python
31+
from kernel import Kernel
32+
33+
client = Kernel(
34+
api_key="My API Key",
35+
)
36+
invocation = client.invocations.create(
37+
action_name="analyze",
38+
app_name="my-app",
39+
version="1.0.0",
40+
)
41+
print(invocation.id)
42+
```
43+
44+
45+
```go Go
46+
package main
47+
48+
import (
49+
"context"
50+
"fmt"
51+
52+
"github.com/onkernel/kernel-go-sdk"
53+
"github.com/onkernel/kernel-go-sdk/option"
54+
)
55+
56+
func main() {
57+
client := kernel.NewClient(
58+
option.WithAPIKey("My API Key"),
59+
)
60+
invocation, err := client.Invocations.New(context.TODO(), kernel.InvocationNewParams{
61+
ActionName: "analyze",
62+
AppName: "my-app",
63+
Version: "1.0.0",
64+
})
65+
if err != nil {
66+
panic(err.Error())
67+
}
68+
fmt.Printf("%+v\n", invocation.ID)
69+
}
70+
```
71+
1372
</CodeGroup>
1473

1574
### Asynchronous invocations

0 commit comments

Comments
 (0)