Skip to content

Commit

Permalink
add completion model
Browse files Browse the repository at this point in the history
  • Loading branch information
lalalune committed Mar 5, 2024
1 parent 313cf45 commit 647abf2
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
11 changes: 10 additions & 1 deletion docs/docs/classes/BgentRuntime.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Creates an instance of BgentRuntime.
| `opts.actions?` | [`Action`](../interfaces/Action.md)[] | Optional custom actions. |
| `opts.debugMode?` | `boolean` | If true, debug messages will be logged. |
| `opts.evaluators?` | [`Evaluator`](../interfaces/Evaluator.md)[] | Optional custom evaluators. |
| `opts.model?` | `string` | The model to use for completion. |
| `opts.providers?` | [`Provider`](../interfaces/Provider.md)[] | Optional context providers. |
| `opts.recentMessageCount?` | `number` | The number of messages to hold in the recent message cache. |
| `opts.serverUrl?` | `string` | The URL of the worker. |
Expand Down Expand Up @@ -93,6 +94,14 @@ Store messages that are sent and received by the agent.

___

### model

**model**: `string` = `"gpt-3.5-turbo-0125"`

The model to use for completion.

___

### providers

**providers**: [`Provider`](../interfaces/Provider.md)[] = `[]`
Expand Down Expand Up @@ -138,7 +147,7 @@ Send a message to the OpenAI API for completion.
| `opts` | `Object` | `undefined` | The options for the completion request. |
| `opts.context` | `undefined` \| `string` | `""` | The context of the message to be completed. |
| `opts.frequency_penalty` | `undefined` \| `number` | `0.0` | The frequency penalty to apply to the completion. |
| `opts.model` | `undefined` \| `string` | `"gpt-3.5-turbo-0125"` | The model to use for completion. |
| `opts.model` | `undefined` \| `string` | `undefined` | The model to use for completion. |
| `opts.presence_penalty` | `undefined` \| `number` | `0.0` | The presence penalty to apply to the completion. |
| `opts.stop` | `undefined` \| `never`[] | `[]` | A list of strings to stop the completion at. |

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bgent",
"version": "0.0.32",
"version": "0.0.33",
"private": false,
"description": "bgent. because agent was taken.",
"type": "module",
Expand Down
10 changes: 9 additions & 1 deletion src/lib/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ export class BgentRuntime {
*/
providers: Provider[] = [];

/**
* The model to use for completion.
*/
model = "gpt-3.5-turbo-0125";

/**
* Store messages that are sent and received by the agent.
*/
Expand Down Expand Up @@ -123,6 +128,7 @@ export class BgentRuntime {
* @param opts.actions - Optional custom actions.
* @param opts.evaluators - Optional custom evaluators.
* @param opts.providers - Optional context providers.
* @param opts.model - The model to use for completion.
*/
constructor(opts: {
recentMessageCount?: number; // number of messages to hold in the recent message cache
Expand All @@ -133,12 +139,14 @@ export class BgentRuntime {
actions?: Action[]; // Optional custom actions
evaluators?: Evaluator[]; // Optional custom evaluators
providers?: Provider[];
model?: string; // The model to use for completion
}) {
this.#recentMessageCount =
opts.recentMessageCount ?? this.#recentMessageCount;
this.debugMode = opts.debugMode ?? false;
this.supabase = opts.supabase;
this.serverUrl = opts.serverUrl ?? this.serverUrl;
this.model = opts.model ?? this.model;
if (!this.serverUrl) {
console.warn("No serverUrl provided, defaulting to localhost");
}
Expand Down Expand Up @@ -202,7 +210,7 @@ export class BgentRuntime {
async completion({
context = "",
stop = [],
model = "gpt-3.5-turbo-0125",
model = this.model,
frequency_penalty = 0.0,
presence_penalty = 0.0,
}) {
Expand Down

0 comments on commit 647abf2

Please sign in to comment.