Commit 53e799e
authored
feat!: replace output_text property with getResponseOutputText helper (#48)
Adds a simple helper function to extract aggregated text output from
ResponseObject instances.
This **replaces** the automatic `output_text` property approach from PR
#42 with an explicit helper function, providing a cleaner API without
prototype patching or side-effectful imports.
## Changes
- **Removes** `src/lib/init.ts` (automatic property patching)
- **Adds** `getResponseOutputText()` helper function
- Works for both streaming and non-streaming responses
## Usage
### Streaming responses
```typescript
import { getResponseOutputText } from 'llama-stack-client';
const stream = await client.responses.create({ stream: true, ... });
for await (const chunk of stream) {
if (chunk.type === 'response.completed') {
const text = getResponseOutputText(chunk.response);
console.log(text);
}
}
```
### Non-streaming responses
```typescript
import { getResponseOutputText } from 'llama-stack-client';
const response = await client.responses.create({ stream: false, ... });
const text = getResponseOutputText(response);
```
This provides a clean, explicit API for accessing aggregated text from
responses without relying on magic property injection.1 parent bced728 commit 53e799e
3 files changed
+61
-129
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
151 | 151 | | |
152 | 152 | | |
153 | 153 | | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | 154 | | |
158 | 155 | | |
159 | 156 | | |
| |||
573 | 570 | | |
574 | 571 | | |
575 | 572 | | |
| 573 | + | |
576 | 574 | | |
577 | 575 | | |
578 | 576 | | |
| |||
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
0 commit comments