Skip to content

Commit

Permalink
feat(message): improve typings of the WithMetadata generic
Browse files Browse the repository at this point in the history
  • Loading branch information
paztek committed Dec 19, 2023
1 parent 2adb980 commit 3b6554a
Show file tree
Hide file tree
Showing 9 changed files with 46 additions and 45 deletions.
31 changes: 16 additions & 15 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ LLobotoMy for Azure

#### Defined in

[src/message/message.ts:32](https://github.com/paztek/llobotomy-azure/blob/3ac86a2/src/message/message.ts#L32)
[src/message/message.ts:32](https://github.com/paztek/llobotomy-azure/blob/2adb980/src/message/message.ts#L32)

___

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

#### Defined in

[src/message/message.ts:16](https://github.com/paztek/llobotomy-azure/blob/3ac86a2/src/message/message.ts#L16)
[src/message/message.ts:16](https://github.com/paztek/llobotomy-azure/blob/2adb980/src/message/message.ts#L16)

___

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

#### Defined in

[src/message/message.ts:20](https://github.com/paztek/llobotomy-azure/blob/3ac86a2/src/message/message.ts#L20)
[src/message/message.ts:20](https://github.com/paztek/llobotomy-azure/blob/2adb980/src/message/message.ts#L20)

___

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

#### Defined in

[src/message/message.ts:25](https://github.com/paztek/llobotomy-azure/blob/3ac86a2/src/message/message.ts#L25)
[src/message/message.ts:25](https://github.com/paztek/llobotomy-azure/blob/2adb980/src/message/message.ts#L25)

___

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

#### Defined in

[src/message/message.ts:12](https://github.com/paztek/llobotomy-azure/blob/3ac86a2/src/message/message.ts#L12)
[src/message/message.ts:12](https://github.com/paztek/llobotomy-azure/blob/2adb980/src/message/message.ts#L12)

___

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

#### Defined in

[src/message/message.ts:18](https://github.com/paztek/llobotomy-azure/blob/3ac86a2/src/message/message.ts#L18)
[src/message/message.ts:18](https://github.com/paztek/llobotomy-azure/blob/2adb980/src/message/message.ts#L18)

___

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

#### Defined in

[src/message/message.ts:14](https://github.com/paztek/llobotomy-azure/blob/3ac86a2/src/message/message.ts#L14)
[src/message/message.ts:14](https://github.com/paztek/llobotomy-azure/blob/2adb980/src/message/message.ts#L14)

___

Expand All @@ -110,23 +110,24 @@ ___

#### Defined in

[src/message/message.ts:23](https://github.com/paztek/llobotomy-azure/blob/3ac86a2/src/message/message.ts#L23)
[src/message/message.ts:23](https://github.com/paztek/llobotomy-azure/blob/2adb980/src/message/message.ts#L23)

___

### WithMetadata

Ƭ **WithMetadata**<`T`\>: `T` & { `metadata?`: `unknown` }
Ƭ **WithMetadata**<`T`, `U`\>: `T` & { `metadata?`: `U` }

#### Type parameters

| Name |
| :------ |
| `T` |
| Name | Type |
| :------ | :------ |
| `T` | `T` |
| `U` | `unknown` |

#### Defined in

[src/message/message.ts:10](https://github.com/paztek/llobotomy-azure/blob/3ac86a2/src/message/message.ts#L10)
[src/message/message.ts:10](https://github.com/paztek/llobotomy-azure/blob/2adb980/src/message/message.ts#L10)

## Functions

Expand All @@ -146,7 +147,7 @@ m is ChatRequestMessage

#### Defined in

[src/thread/thread.ts:196](https://github.com/paztek/llobotomy-azure/blob/3ac86a2/src/thread/thread.ts#L196)
[src/thread/thread.ts:196](https://github.com/paztek/llobotomy-azure/blob/2adb980/src/thread/thread.ts#L196)

___

Expand All @@ -166,4 +167,4 @@ m is ChatResponseMessage

#### Defined in

[src/thread/thread.ts:190](https://github.com/paztek/llobotomy-azure/blob/3ac86a2/src/thread/thread.ts#L190)
[src/thread/thread.ts:190](https://github.com/paztek/llobotomy-azure/blob/2adb980/src/thread/thread.ts#L190)
12 changes: 6 additions & 6 deletions docs/classes/Assistant.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

#### Defined in

[src/assistant/assistant.ts:24](https://github.com/paztek/llobotomy-azure/blob/3ac86a2/src/assistant/assistant.ts#L24)
[src/assistant/assistant.ts:24](https://github.com/paztek/llobotomy-azure/blob/2adb980/src/assistant/assistant.ts#L24)

## Properties

Expand All @@ -43,7 +43,7 @@

#### Defined in

[src/assistant/assistant.ts:18](https://github.com/paztek/llobotomy-azure/blob/3ac86a2/src/assistant/assistant.ts#L18)
[src/assistant/assistant.ts:18](https://github.com/paztek/llobotomy-azure/blob/2adb980/src/assistant/assistant.ts#L18)

___

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

#### Defined in

[src/assistant/assistant.ts:22](https://github.com/paztek/llobotomy-azure/blob/3ac86a2/src/assistant/assistant.ts#L22)
[src/assistant/assistant.ts:22](https://github.com/paztek/llobotomy-azure/blob/2adb980/src/assistant/assistant.ts#L22)

___

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

#### Defined in

[src/assistant/assistant.ts:20](https://github.com/paztek/llobotomy-azure/blob/3ac86a2/src/assistant/assistant.ts#L20)
[src/assistant/assistant.ts:20](https://github.com/paztek/llobotomy-azure/blob/2adb980/src/assistant/assistant.ts#L20)

___

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

#### Defined in

[src/assistant/assistant.ts:21](https://github.com/paztek/llobotomy-azure/blob/3ac86a2/src/assistant/assistant.ts#L21)
[src/assistant/assistant.ts:21](https://github.com/paztek/llobotomy-azure/blob/2adb980/src/assistant/assistant.ts#L21)

## Methods

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

#### Defined in

[src/assistant/assistant.ts:31](https://github.com/paztek/llobotomy-azure/blob/3ac86a2/src/assistant/assistant.ts#L31)
[src/assistant/assistant.ts:31](https://github.com/paztek/llobotomy-azure/blob/2adb980/src/assistant/assistant.ts#L31)
6 changes: 3 additions & 3 deletions docs/classes/RequiredAction.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ EventEmitter.constructor

#### Defined in

[src/thread/thread.ts:175](https://github.com/paztek/llobotomy-azure/blob/3ac86a2/src/thread/thread.ts#L175)
[src/thread/thread.ts:175](https://github.com/paztek/llobotomy-azure/blob/2adb980/src/thread/thread.ts#L175)

## Properties

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

#### Defined in

[src/thread/thread.ts:175](https://github.com/paztek/llobotomy-azure/blob/3ac86a2/src/thread/thread.ts#L175)
[src/thread/thread.ts:175](https://github.com/paztek/llobotomy-azure/blob/2adb980/src/thread/thread.ts#L175)

___

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

#### Defined in

[src/thread/thread.ts:179](https://github.com/paztek/llobotomy-azure/blob/3ac86a2/src/thread/thread.ts#L179)
[src/thread/thread.ts:179](https://github.com/paztek/llobotomy-azure/blob/2adb980/src/thread/thread.ts#L179)

___

Expand Down
20 changes: 10 additions & 10 deletions docs/classes/Thread.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ EventEmitter.constructor

#### Defined in

[src/thread/thread.ts:21](https://github.com/paztek/llobotomy-azure/blob/3ac86a2/src/thread/thread.ts#L21)
[src/thread/thread.ts:21](https://github.com/paztek/llobotomy-azure/blob/2adb980/src/thread/thread.ts#L21)

## Properties

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

#### Defined in

[src/thread/thread.ts:18](https://github.com/paztek/llobotomy-azure/blob/3ac86a2/src/thread/thread.ts#L18)
[src/thread/thread.ts:18](https://github.com/paztek/llobotomy-azure/blob/2adb980/src/thread/thread.ts#L18)

___

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

#### Defined in

[src/thread/thread.ts:19](https://github.com/paztek/llobotomy-azure/blob/3ac86a2/src/thread/thread.ts#L19)
[src/thread/thread.ts:19](https://github.com/paztek/llobotomy-azure/blob/2adb980/src/thread/thread.ts#L19)

___

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

#### Defined in

[src/thread/thread.ts:21](https://github.com/paztek/llobotomy-azure/blob/3ac86a2/src/thread/thread.ts#L21)
[src/thread/thread.ts:21](https://github.com/paztek/llobotomy-azure/blob/2adb980/src/thread/thread.ts#L21)

___

Expand Down Expand Up @@ -240,7 +240,7 @@ node_modules/@types/node/events.d.ts:395

#### Defined in

[src/thread/thread.ts:25](https://github.com/paztek/llobotomy-azure/blob/3ac86a2/src/thread/thread.ts#L25)
[src/thread/thread.ts:25](https://github.com/paztek/llobotomy-azure/blob/2adb980/src/thread/thread.ts#L25)

## Methods

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

#### Defined in

[src/thread/thread.ts:33](https://github.com/paztek/llobotomy-azure/blob/3ac86a2/src/thread/thread.ts#L33)
[src/thread/thread.ts:33](https://github.com/paztek/llobotomy-azure/blob/2adb980/src/thread/thread.ts#L33)

___

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

#### Defined in

[src/thread/thread.ts:153](https://github.com/paztek/llobotomy-azure/blob/3ac86a2/src/thread/thread.ts#L153)
[src/thread/thread.ts:153](https://github.com/paztek/llobotomy-azure/blob/2adb980/src/thread/thread.ts#L153)

___

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

#### Defined in

[src/thread/thread.ts:44](https://github.com/paztek/llobotomy-azure/blob/3ac86a2/src/thread/thread.ts#L44)
[src/thread/thread.ts:44](https://github.com/paztek/llobotomy-azure/blob/2adb980/src/thread/thread.ts#L44)

___

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

#### Defined in

[src/thread/thread.ts:167](https://github.com/paztek/llobotomy-azure/blob/3ac86a2/src/thread/thread.ts#L167)
[src/thread/thread.ts:167](https://github.com/paztek/llobotomy-azure/blob/2adb980/src/thread/thread.ts#L167)

___

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

#### Defined in

[src/thread/thread.ts:37](https://github.com/paztek/llobotomy-azure/blob/3ac86a2/src/thread/thread.ts#L37)
[src/thread/thread.ts:37](https://github.com/paztek/llobotomy-azure/blob/2adb980/src/thread/thread.ts#L37)

___

Expand Down
8 changes: 4 additions & 4 deletions docs/interfaces/AssistantCreateParams.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

#### Defined in

[src/assistant/assistant.ts:11](https://github.com/paztek/llobotomy-azure/blob/3ac86a2/src/assistant/assistant.ts#L11)
[src/assistant/assistant.ts:11](https://github.com/paztek/llobotomy-azure/blob/2adb980/src/assistant/assistant.ts#L11)

___

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

#### Defined in

[src/assistant/assistant.ts:14](https://github.com/paztek/llobotomy-azure/blob/3ac86a2/src/assistant/assistant.ts#L14)
[src/assistant/assistant.ts:14](https://github.com/paztek/llobotomy-azure/blob/2adb980/src/assistant/assistant.ts#L14)

___

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

#### Defined in

[src/assistant/assistant.ts:12](https://github.com/paztek/llobotomy-azure/blob/3ac86a2/src/assistant/assistant.ts#L12)
[src/assistant/assistant.ts:12](https://github.com/paztek/llobotomy-azure/blob/2adb980/src/assistant/assistant.ts#L12)

___

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

#### Defined in

[src/assistant/assistant.ts:13](https://github.com/paztek/llobotomy-azure/blob/3ac86a2/src/assistant/assistant.ts#L13)
[src/assistant/assistant.ts:13](https://github.com/paztek/llobotomy-azure/blob/2adb980/src/assistant/assistant.ts#L13)
6 changes: 3 additions & 3 deletions docs/interfaces/ToolOutput.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

#### Defined in

[src/thread/thread.ts:185](https://github.com/paztek/llobotomy-azure/blob/3ac86a2/src/thread/thread.ts#L185)
[src/thread/thread.ts:185](https://github.com/paztek/llobotomy-azure/blob/2adb980/src/thread/thread.ts#L185)

___

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

#### Defined in

[src/thread/thread.ts:187](https://github.com/paztek/llobotomy-azure/blob/3ac86a2/src/thread/thread.ts#L187)
[src/thread/thread.ts:187](https://github.com/paztek/llobotomy-azure/blob/2adb980/src/thread/thread.ts#L187)

___

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

#### Defined in

[src/thread/thread.ts:186](https://github.com/paztek/llobotomy-azure/blob/3ac86a2/src/thread/thread.ts#L186)
[src/thread/thread.ts:186](https://github.com/paztek/llobotomy-azure/blob/2adb980/src/thread/thread.ts#L186)
2 changes: 1 addition & 1 deletion src/message/message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import type {
ChatRequestUserMessage,
} from '@azure/openai/types/src/models/models';

export type WithMetadata<T> = T & { metadata?: unknown };
export type WithMetadata<T, U = unknown> = T & { metadata?: U };

export type ChatRequestSystemMessageWithMetadata =
WithMetadata<ChatRequestSystemMessage>;
Expand Down
4 changes: 2 additions & 2 deletions types/message/message.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { ChatResponseMessage } from '@azure/openai';
import type { ChatRequestAssistantMessage, ChatRequestFunctionMessage, ChatRequestSystemMessage, ChatRequestToolMessage, ChatRequestUserMessage } from '@azure/openai/types/src/models/models';
export type WithMetadata<T> = T & {
metadata?: unknown;
export type WithMetadata<T, U = unknown> = T & {
metadata?: U;
};
export type ChatRequestSystemMessageWithMetadata = WithMetadata<ChatRequestSystemMessage>;
export type ChatRequestUserMessageWithMetadata = WithMetadata<ChatRequestUserMessage>;
Expand Down
2 changes: 1 addition & 1 deletion types/message/message.d.ts.map

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

0 comments on commit 3b6554a

Please sign in to comment.