mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-16 05:03:26 +00:00
docs(ai): document onPayload callback
This commit is contained in:
parent
ea02243a18
commit
023f6e2fa4
1 changed files with 14 additions and 0 deletions
|
|
@ -598,6 +598,20 @@ context.messages.push({ role: 'user', content: 'Please continue' });
|
|||
const continuation = await complete(model, context);
|
||||
```
|
||||
|
||||
### Debugging Provider Payloads
|
||||
|
||||
Use the `onPayload` callback to inspect the request payload sent to the provider. This is useful for debugging request formatting issues or provider validation errors.
|
||||
|
||||
```typescript
|
||||
const response = await complete(model, context, {
|
||||
onPayload: (payload) => {
|
||||
console.log('Provider payload:', JSON.stringify(payload, null, 2));
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
The callback is supported by `stream`, `complete`, `streamSimple`, and `completeSimple`.
|
||||
|
||||
## APIs, Models, and Providers
|
||||
|
||||
The library implements 4 API interfaces, each with its own streaming function and options:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue