@brainstack/agent
Advanced tools
Comparing version 1.0.18 to 1.0.19
import { IModel } from '../abstraction'; | ||
export type TIntegrationAzureOptions = { | ||
max_tokens?: number; | ||
temperature?: number; | ||
}; | ||
export declare class IntegrationAzure implements IModel { | ||
private apiKey; | ||
private baseUrl; | ||
constructor(apiKey: string, baseUrl: string); | ||
private options; | ||
constructor(apiKey: string, baseUrl: string, options?: TIntegrationAzureOptions); | ||
_ask(input: string, content?: string): Promise<string | null>; | ||
} |
@@ -17,6 +17,11 @@ "use strict"; | ||
const axios_1 = __importDefault(require("axios")); | ||
const defaultIntegrationAzureOptions = { | ||
max_tokens: 4096, | ||
temperature: 0.8 | ||
}; | ||
class IntegrationAzure { | ||
constructor(apiKey, baseUrl) { | ||
constructor(apiKey, baseUrl, options = defaultIntegrationAzureOptions) { | ||
this.apiKey = apiKey; | ||
this.baseUrl = baseUrl; | ||
this.options = options; | ||
} | ||
@@ -27,7 +32,3 @@ _ask(input, content = 'You are a helpful assistant.') { | ||
const url = `${this.baseUrl}`; | ||
const body = { | ||
messages: [{ role: 'system', content }, { role: 'user', content: input }], | ||
max_tokens: 100, | ||
temperature: 0.7 | ||
}; | ||
const body = Object.assign({ messages: [{ role: 'system', content }, { role: 'user', content: input }] }, this.options); | ||
const response = yield axios_1.default.post(url, body, { | ||
@@ -34,0 +35,0 @@ headers: { |
{ | ||
"name": "@brainstack/agent", | ||
"version": "1.0.18", | ||
"version": "1.0.19", | ||
"description": "Brainstack Model Agent Lib", | ||
@@ -43,3 +43,3 @@ "main": "dist/index.js", | ||
}, | ||
"gitHead": "862eb4cbb9085b4ff38d2322f7fb69baf24873e7" | ||
"gitHead": "ce145955009164e1f8d39edddcbcc5895f1549b3" | ||
} |
import axios from 'axios'; | ||
import { IModel } from '../abstraction'; | ||
export type TIntegrationAzureOptions = { | ||
max_tokens?: number, | ||
temperature?: number | ||
} | ||
const defaultIntegrationAzureOptions: TIntegrationAzureOptions = { | ||
max_tokens: 4096, | ||
temperature: 0.8 | ||
} | ||
export class IntegrationAzure implements IModel { | ||
private apiKey: string; | ||
private baseUrl: string; | ||
private options: TIntegrationAzureOptions; | ||
constructor(apiKey: string, baseUrl: string) { | ||
constructor(apiKey: string, baseUrl: string, options=defaultIntegrationAzureOptions) { | ||
this.apiKey = apiKey; | ||
this.baseUrl = baseUrl; | ||
this.options = options; | ||
} | ||
@@ -18,4 +30,3 @@ | ||
messages: [{ role: 'system', content }, { role: 'user', content: input }], | ||
max_tokens: 100, | ||
temperature: 0.7 | ||
...this.options | ||
}; | ||
@@ -22,0 +33,0 @@ |
21487
442