feat(stage1): этап 1 — извлечение resource_type через LLM по списку реальных ресурсов

This commit is contained in:
Repinoid
2026-10-07 13:48:19 +03:00
parent 827870d51c
commit 4e8d115c26
2 changed files with 197 additions and 1 deletions
+6 -1
View File
@@ -270,7 +270,8 @@ function createSemaphore(max) {
* baseUrl?:string,
* apiKey?:string,
* model?:string,
* temperature?:number
* temperature?:number,
* responseFormat?:{type:string} // напр. {type:'json_object'}
* }} params
* @returns {Promise<string>} — содержимое choices[0].message.content
*/
@@ -282,6 +283,7 @@ async function llmChat({
apiKey = ENV.LLM_API_KEY,
model = ENV.LLM_MODEL,
temperature,
responseFormat,
}) {
const base = String(baseUrl).replace(/\/+$/, '');
const url = `${base}/v1/chat/completions`;
@@ -293,6 +295,9 @@ async function llmChat({
if (temperature !== undefined && temperature !== null) {
payload.temperature = temperature;
}
if (responseFormat !== undefined && responseFormat !== null) {
payload.response_format = responseFormat;
}
const signal = controller ? controller.signal : undefined;