UNPKG

@competent-devs/test-forge

Version:

Package for UI unit test generation based on storybook context

23 lines 876 B
import { AzureChatOpenAI } from "@langchain/openai"; import { getConfig, DEPLOYMENT, API_VERSION } from "../services/config.js"; export const invokeLlm = async (messages) => { const { DIAL_API_KEY, DIAL_PROXY_URL } = await getConfig(); const API_BASE_PATH = `https://${DIAL_PROXY_URL}/openai/deployments/${DEPLOYMENT}/chat/completions?api-version=${API_VERSION}`; const llm = new AzureChatOpenAI({ azureOpenAIApiKey: DIAL_API_KEY, azureOpenAIApiVersion: "2024-07-01-preview", azureOpenAIBasePath: API_BASE_PATH, temperature: 0.2, maxTokens: undefined, timeout: undefined, maxRetries: 1, }); try { const response = await llm.invoke(messages); return response; } catch (err) { console.error("Error during LLM execution:", err); } }; //# sourceMappingURL=agent.js.map