Skip to content

Commit

Permalink
feat(assistant): allow configuring the temperature and the topP of th…
Browse files Browse the repository at this point in the history
…e assistant
  • Loading branch information
paztek committed Feb 20, 2024
1 parent dd7663a commit e7a9b63
Show file tree
Hide file tree
Showing 26 changed files with 163 additions and 67 deletions.
10 changes: 9 additions & 1 deletion dist/index.cjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* llobotomy-azure v0.0.6
* llobotomy-azure v0.0.7
* (c) Matthieu Balmes
* Released under the MIT License.
*/
Expand All @@ -15,6 +15,8 @@ class Assistant {
this.instructions = params.instructions;
this.tools = params.tools;
this.deployment = params.deployment;
this.temperature = params.temperature;
this.topP = params.topP;
this.useLegacyFunctions = params.useLegacyFunctions ?? false;
}
async streamChatCompletions(messages) {
Expand All @@ -25,6 +27,12 @@ class Assistant {
};
messages = [systemMessage, ...messages];
const options = {};
if (this.temperature !== undefined) {
options.temperature = this.temperature;
}
if (this.topP !== undefined) {
options.topP = this.topP;
}
if (this.tools.length > 0) {
if (this.useLegacyFunctions) {
// Convert tools to functions
Expand Down
2 changes: 1 addition & 1 deletion dist/index.cjs.map

Large diffs are not rendered by default.

10 changes: 9 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.

10 changes: 9 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.

10 changes: 9 additions & 1 deletion dist/index.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* llobotomy-azure v0.0.6
* llobotomy-azure v0.0.7
* (c) Matthieu Balmes
* Released under the MIT License.
*/
Expand All @@ -13,6 +13,8 @@ class Assistant {
this.instructions = params.instructions;
this.tools = params.tools;
this.deployment = params.deployment;
this.temperature = params.temperature;
this.topP = params.topP;
this.useLegacyFunctions = params.useLegacyFunctions ?? false;
}
async streamChatCompletions(messages) {
Expand All @@ -23,6 +25,12 @@ class Assistant {
};
messages = [systemMessage, ...messages];
const options = {};
if (this.temperature !== undefined) {
options.temperature = this.temperature;
}
if (this.topP !== undefined) {
options.topP = this.topP;
}
if (this.tools.length > 0) {
if (this.useLegacyFunctions) {
// Convert tools to functions
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/5572695/src/message/message.ts#L32)
[src/message/message.ts:32](https://github.com/paztek/llobotomy-azure/blob/dd7663a/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/5572695/src/message/message.ts#L16)
[src/message/message.ts:16](https://github.com/paztek/llobotomy-azure/blob/dd7663a/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/5572695/src/message/message.ts#L20)
[src/message/message.ts:20](https://github.com/paztek/llobotomy-azure/blob/dd7663a/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/5572695/src/message/message.ts#L25)
[src/message/message.ts:25](https://github.com/paztek/llobotomy-azure/blob/dd7663a/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/5572695/src/message/message.ts#L12)
[src/message/message.ts:12](https://github.com/paztek/llobotomy-azure/blob/dd7663a/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/5572695/src/message/message.ts#L18)
[src/message/message.ts:18](https://github.com/paztek/llobotomy-azure/blob/dd7663a/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/5572695/src/message/message.ts#L14)
[src/message/message.ts:14](https://github.com/paztek/llobotomy-azure/blob/dd7663a/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/5572695/src/message/message.ts#L23)
[src/message/message.ts:23](https://github.com/paztek/llobotomy-azure/blob/dd7663a/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/5572695/src/message/message.ts#L10)
[src/message/message.ts:10](https://github.com/paztek/llobotomy-azure/blob/dd7663a/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/5572695/src/thread/thread.ts#L426)
[src/thread/thread.ts:426](https://github.com/paztek/llobotomy-azure/blob/dd7663a/src/thread/thread.ts#L426)

___

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

#### Defined in

[src/thread/thread.ts:420](https://github.com/paztek/llobotomy-azure/blob/5572695/src/thread/thread.ts#L420)
[src/thread/thread.ts:420](https://github.com/paztek/llobotomy-azure/blob/dd7663a/src/thread/thread.ts#L420)
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/5572695/src/thread/errors.ts#L8)
[src/thread/errors.ts:8](https://github.com/paztek/llobotomy-azure/blob/dd7663a/src/thread/errors.ts#L8)

## Properties

Expand Down
36 changes: 29 additions & 7 deletions docs/classes/Assistant.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
- [client](Assistant.md#client)
- [deployment](Assistant.md#deployment)
- [instructions](Assistant.md#instructions)
- [temperature](Assistant.md#temperature)
- [tools](Assistant.md#tools)
- [topP](Assistant.md#topp)
- [useLegacyFunctions](Assistant.md#uselegacyfunctions)

### Methods
Expand All @@ -34,7 +36,7 @@

#### Defined in

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

## Properties

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

#### Defined in

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

___

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

#### Defined in

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

___

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

#### Defined in

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

___

### temperature

`Private` `Readonly` **temperature**: `undefined` \| `number`

#### Defined in

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

___

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

#### Defined in

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

___

### topP

`Private` `Readonly` **topP**: `undefined` \| `number`

#### Defined in

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

___

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

#### Defined in

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

## Methods

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

#### Defined in

[src/assistant/assistant.ts:34](https://github.com/paztek/llobotomy-azure/blob/5572695/src/assistant/assistant.ts#L34)
[src/assistant/assistant.ts:42](https://github.com/paztek/llobotomy-azure/blob/dd7663a/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/5572695/src/thread/errors.ts#L32)
[src/thread/errors.ts:32](https://github.com/paztek/llobotomy-azure/blob/dd7663a/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/5572695/src/thread/errors.ts#L24)
[src/thread/errors.ts:24](https://github.com/paztek/llobotomy-azure/blob/dd7663a/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/5572695/src/thread/errors.ts#L16)
[src/thread/errors.ts:16](https://github.com/paztek/llobotomy-azure/blob/dd7663a/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/5572695/src/thread/errors.ts#L48)
[src/thread/errors.ts:48](https://github.com/paztek/llobotomy-azure/blob/dd7663a/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/5572695/src/thread/thread.ts#L402)
[src/thread/thread.ts:402](https://github.com/paztek/llobotomy-azure/blob/dd7663a/src/thread/thread.ts#L402)

## Properties

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

#### Defined in

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

___

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

#### Defined in

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

___

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

#### Defined in

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

___

Expand Down
Loading

0 comments on commit e7a9b63

Please sign in to comment.