This commit is contained in:
@@ -1,10 +1,17 @@
|
|||||||
import 'dotenv/config';
|
import 'dotenv/config';
|
||||||
import OpenAI from 'openai';
|
import OpenAI from 'openai';
|
||||||
|
|
||||||
const ovhAI = new OpenAI({
|
let ovhAI: OpenAI | null = null;
|
||||||
|
|
||||||
|
function getClient(): OpenAI {
|
||||||
|
if (!ovhAI) {
|
||||||
|
ovhAI = new OpenAI({
|
||||||
apiKey: process.env.OVHCLOUD_API_KEY,
|
apiKey: process.env.OVHCLOUD_API_KEY,
|
||||||
baseURL: 'https://oai.endpoints.kepler.ai.cloud.ovh.net/v1'
|
baseURL: 'https://oai.endpoints.kepler.ai.cloud.ovh.net/v1'
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
return ovhAI;
|
||||||
|
}
|
||||||
|
|
||||||
export interface BaseTool {
|
export interface BaseTool {
|
||||||
readonly name: string;
|
readonly name: string;
|
||||||
@@ -28,7 +35,7 @@ export async function makeRequest<T extends BaseTool>(
|
|||||||
toolDef: T
|
toolDef: T
|
||||||
): Promise<Record<string, unknown>> {
|
): Promise<Record<string, unknown>> {
|
||||||
try {
|
try {
|
||||||
const completion = await ovhAI.chat.completions.create({
|
const completion = await getClient().chat.completions.create({
|
||||||
model: 'Meta-Llama-3_3-70B-Instruct',
|
model: 'Meta-Llama-3_3-70B-Instruct',
|
||||||
temperature: 1,
|
temperature: 1,
|
||||||
max_tokens: 16000,
|
max_tokens: 16000,
|
||||||
|
|||||||
Reference in New Issue
Block a user