Skip to content

Commit

Permalink
fix(thread): only convert tool call responses to string if they're no…
Browse files Browse the repository at this point in the history
…t strings
  • Loading branch information
paztek committed Feb 21, 2024
1 parent e7a9b63 commit db809e5
Show file tree
Hide file tree
Showing 24 changed files with 82 additions and 71 deletions.
4 changes: 3 additions & 1 deletion dist/index.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,9 @@ class Thread extends EventEmitter {
for (const toolOutput of toolOutputs) {
const message = {
role: 'tool',
content: JSON.stringify(toolOutput.value),
content: typeof toolOutput.value === 'string'
? toolOutput.value
: JSON.stringify(toolOutput.value),
toolCallId: toolOutput.callId,
};
if (toolOutput.metadata !== void 0) {
Expand Down
2 changes: 1 addition & 1 deletion dist/index.cjs.map

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion dist/index.esm.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.esm.js.map

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion dist/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,9 @@ class Thread extends EventEmitter {
for (const toolOutput of toolOutputs) {
const message = {
role: 'tool',
content: JSON.stringify(toolOutput.value),
content: typeof toolOutput.value === 'string'
? toolOutput.value
: JSON.stringify(toolOutput.value),
toolCallId: toolOutput.callId,
};
if (toolOutput.metadata !== void 0) {
Expand Down
2 changes: 1 addition & 1 deletion dist/index.mjs.map

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ LLobotoMy for Azure

#### Defined in

[src/message/message.ts:32](https://github.com/paztek/llobotomy-azure/blob/dd7663a/src/message/message.ts#L32)
[src/message/message.ts:32](https://github.com/paztek/llobotomy-azure/blob/e7a9b63/src/message/message.ts#L32)

___

Expand All @@ -58,7 +58,7 @@ ___

#### Defined in

[src/message/message.ts:16](https://github.com/paztek/llobotomy-azure/blob/dd7663a/src/message/message.ts#L16)
[src/message/message.ts:16](https://github.com/paztek/llobotomy-azure/blob/e7a9b63/src/message/message.ts#L16)

___

Expand All @@ -68,7 +68,7 @@ ___

#### Defined in

[src/message/message.ts:20](https://github.com/paztek/llobotomy-azure/blob/dd7663a/src/message/message.ts#L20)
[src/message/message.ts:20](https://github.com/paztek/llobotomy-azure/blob/e7a9b63/src/message/message.ts#L20)

___

Expand All @@ -78,7 +78,7 @@ ___

#### Defined in

[src/message/message.ts:25](https://github.com/paztek/llobotomy-azure/blob/dd7663a/src/message/message.ts#L25)
[src/message/message.ts:25](https://github.com/paztek/llobotomy-azure/blob/e7a9b63/src/message/message.ts#L25)

___

Expand All @@ -88,7 +88,7 @@ ___

#### Defined in

[src/message/message.ts:12](https://github.com/paztek/llobotomy-azure/blob/dd7663a/src/message/message.ts#L12)
[src/message/message.ts:12](https://github.com/paztek/llobotomy-azure/blob/e7a9b63/src/message/message.ts#L12)

___

Expand All @@ -98,7 +98,7 @@ ___

#### Defined in

[src/message/message.ts:18](https://github.com/paztek/llobotomy-azure/blob/dd7663a/src/message/message.ts#L18)
[src/message/message.ts:18](https://github.com/paztek/llobotomy-azure/blob/e7a9b63/src/message/message.ts#L18)

___

Expand All @@ -108,7 +108,7 @@ ___

#### Defined in

[src/message/message.ts:14](https://github.com/paztek/llobotomy-azure/blob/dd7663a/src/message/message.ts#L14)
[src/message/message.ts:14](https://github.com/paztek/llobotomy-azure/blob/e7a9b63/src/message/message.ts#L14)

___

Expand All @@ -118,7 +118,7 @@ ___

#### Defined in

[src/message/message.ts:23](https://github.com/paztek/llobotomy-azure/blob/dd7663a/src/message/message.ts#L23)
[src/message/message.ts:23](https://github.com/paztek/llobotomy-azure/blob/e7a9b63/src/message/message.ts#L23)

___

Expand All @@ -135,7 +135,7 @@ ___

#### Defined in

[src/message/message.ts:10](https://github.com/paztek/llobotomy-azure/blob/dd7663a/src/message/message.ts#L10)
[src/message/message.ts:10](https://github.com/paztek/llobotomy-azure/blob/e7a9b63/src/message/message.ts#L10)

## Functions

Expand All @@ -155,7 +155,7 @@ m is ChatRequestMessage

#### Defined in

[src/thread/thread.ts:426](https://github.com/paztek/llobotomy-azure/blob/dd7663a/src/thread/thread.ts#L426)
[src/thread/thread.ts:429](https://github.com/paztek/llobotomy-azure/blob/e7a9b63/src/thread/thread.ts#L429)

___

Expand All @@ -175,4 +175,4 @@ m is ChatResponseMessage

#### Defined in

[src/thread/thread.ts:420](https://github.com/paztek/llobotomy-azure/blob/dd7663a/src/thread/thread.ts#L420)
[src/thread/thread.ts:423](https://github.com/paztek/llobotomy-azure/blob/e7a9b63/src/thread/thread.ts#L423)
2 changes: 1 addition & 1 deletion docs/classes/AccessDeniedError.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Error.constructor

#### Defined in

[src/thread/errors.ts:8](https://github.com/paztek/llobotomy-azure/blob/dd7663a/src/thread/errors.ts#L8)
[src/thread/errors.ts:8](https://github.com/paztek/llobotomy-azure/blob/e7a9b63/src/thread/errors.ts#L8)

## Properties

Expand Down
18 changes: 9 additions & 9 deletions docs/classes/Assistant.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

#### Defined in

[src/assistant/assistant.ts:30](https://github.com/paztek/llobotomy-azure/blob/dd7663a/src/assistant/assistant.ts#L30)
[src/assistant/assistant.ts:30](https://github.com/paztek/llobotomy-azure/blob/e7a9b63/src/assistant/assistant.ts#L30)

## Properties

Expand All @@ -46,7 +46,7 @@

#### Defined in

[src/assistant/assistant.ts:21](https://github.com/paztek/llobotomy-azure/blob/dd7663a/src/assistant/assistant.ts#L21)
[src/assistant/assistant.ts:21](https://github.com/paztek/llobotomy-azure/blob/e7a9b63/src/assistant/assistant.ts#L21)

___

Expand All @@ -56,7 +56,7 @@ ___

#### Defined in

[src/assistant/assistant.ts:25](https://github.com/paztek/llobotomy-azure/blob/dd7663a/src/assistant/assistant.ts#L25)
[src/assistant/assistant.ts:25](https://github.com/paztek/llobotomy-azure/blob/e7a9b63/src/assistant/assistant.ts#L25)

___

Expand All @@ -66,7 +66,7 @@ ___

#### Defined in

[src/assistant/assistant.ts:23](https://github.com/paztek/llobotomy-azure/blob/dd7663a/src/assistant/assistant.ts#L23)
[src/assistant/assistant.ts:23](https://github.com/paztek/llobotomy-azure/blob/e7a9b63/src/assistant/assistant.ts#L23)

___

Expand All @@ -76,7 +76,7 @@ ___

#### Defined in

[src/assistant/assistant.ts:26](https://github.com/paztek/llobotomy-azure/blob/dd7663a/src/assistant/assistant.ts#L26)
[src/assistant/assistant.ts:26](https://github.com/paztek/llobotomy-azure/blob/e7a9b63/src/assistant/assistant.ts#L26)

___

Expand All @@ -86,7 +86,7 @@ ___

#### Defined in

[src/assistant/assistant.ts:24](https://github.com/paztek/llobotomy-azure/blob/dd7663a/src/assistant/assistant.ts#L24)
[src/assistant/assistant.ts:24](https://github.com/paztek/llobotomy-azure/blob/e7a9b63/src/assistant/assistant.ts#L24)

___

Expand All @@ -96,7 +96,7 @@ ___

#### Defined in

[src/assistant/assistant.ts:27](https://github.com/paztek/llobotomy-azure/blob/dd7663a/src/assistant/assistant.ts#L27)
[src/assistant/assistant.ts:27](https://github.com/paztek/llobotomy-azure/blob/e7a9b63/src/assistant/assistant.ts#L27)

___

Expand All @@ -106,7 +106,7 @@ ___

#### Defined in

[src/assistant/assistant.ts:28](https://github.com/paztek/llobotomy-azure/blob/dd7663a/src/assistant/assistant.ts#L28)
[src/assistant/assistant.ts:28](https://github.com/paztek/llobotomy-azure/blob/e7a9b63/src/assistant/assistant.ts#L28)

## Methods

Expand All @@ -126,4 +126,4 @@ ___

#### Defined in

[src/assistant/assistant.ts:42](https://github.com/paztek/llobotomy-azure/blob/dd7663a/src/assistant/assistant.ts#L42)
[src/assistant/assistant.ts:42](https://github.com/paztek/llobotomy-azure/blob/e7a9b63/src/assistant/assistant.ts#L42)
2 changes: 1 addition & 1 deletion docs/classes/ContentFilterError.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@

#### Defined in

[src/thread/errors.ts:32](https://github.com/paztek/llobotomy-azure/blob/dd7663a/src/thread/errors.ts#L32)
[src/thread/errors.ts:32](https://github.com/paztek/llobotomy-azure/blob/e7a9b63/src/thread/errors.ts#L32)

## Properties

Expand Down
2 changes: 1 addition & 1 deletion docs/classes/ContextLengthExceededError.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@

#### Defined in

[src/thread/errors.ts:24](https://github.com/paztek/llobotomy-azure/blob/dd7663a/src/thread/errors.ts#L24)
[src/thread/errors.ts:24](https://github.com/paztek/llobotomy-azure/blob/e7a9b63/src/thread/errors.ts#L24)

## Properties

Expand Down
2 changes: 1 addition & 1 deletion docs/classes/InvalidRequestError.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Error.constructor

#### Defined in

[src/thread/errors.ts:16](https://github.com/paztek/llobotomy-azure/blob/dd7663a/src/thread/errors.ts#L16)
[src/thread/errors.ts:16](https://github.com/paztek/llobotomy-azure/blob/e7a9b63/src/thread/errors.ts#L16)

## Properties

Expand Down
2 changes: 1 addition & 1 deletion docs/classes/InvalidToolOutputsError.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Error.constructor

#### Defined in

[src/thread/errors.ts:48](https://github.com/paztek/llobotomy-azure/blob/dd7663a/src/thread/errors.ts#L48)
[src/thread/errors.ts:48](https://github.com/paztek/llobotomy-azure/blob/e7a9b63/src/thread/errors.ts#L48)

## Properties

Expand Down
8 changes: 4 additions & 4 deletions docs/classes/RequiredAction.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ EventEmitter.constructor

#### Defined in

[src/thread/thread.ts:402](https://github.com/paztek/llobotomy-azure/blob/dd7663a/src/thread/thread.ts#L402)
[src/thread/thread.ts:405](https://github.com/paztek/llobotomy-azure/blob/e7a9b63/src/thread/thread.ts#L405)

## Properties

Expand All @@ -93,7 +93,7 @@ EventEmitter.constructor

#### Defined in

[src/thread/thread.ts:404](https://github.com/paztek/llobotomy-azure/blob/dd7663a/src/thread/thread.ts#L404)
[src/thread/thread.ts:407](https://github.com/paztek/llobotomy-azure/blob/e7a9b63/src/thread/thread.ts#L407)

___

Expand All @@ -103,7 +103,7 @@ ___

#### Defined in

[src/thread/thread.ts:403](https://github.com/paztek/llobotomy-azure/blob/dd7663a/src/thread/thread.ts#L403)
[src/thread/thread.ts:406](https://github.com/paztek/llobotomy-azure/blob/e7a9b63/src/thread/thread.ts#L406)

___

Expand Down Expand Up @@ -960,7 +960,7 @@ ___

#### Defined in

[src/thread/thread.ts:409](https://github.com/paztek/llobotomy-azure/blob/dd7663a/src/thread/thread.ts#L409)
[src/thread/thread.ts:412](https://github.com/paztek/llobotomy-azure/blob/e7a9b63/src/thread/thread.ts#L412)

___

Expand Down

0 comments on commit db809e5

Please sign in to comment.