Skip to content

Commit

Permalink
chore(llm): adjust more precisely the fingerprint when it fails retur…
Browse files Browse the repository at this point in the history
…ning the right response format
  • Loading branch information
sneko committed Mar 15, 2024
1 parent fbb9b94 commit 5bc7d37
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/features/initiative.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import {
WebsiteTemplateSchemaType,
resultSchemaDefinition,
} from '@etabli/src/gpt/template';
import { getServerTranslation } from '@etabli/src/i18n';
import { llmResponseFormatError, tokensReachTheLimitError } from '@etabli/src/models/entities/errors';
import { LiteInitiativeMapSchema, LiteInitiativeMapSchemaType } from '@etabli/src/models/entities/initiative';
import { prisma } from '@etabli/src/prisma';
Expand Down Expand Up @@ -646,6 +647,10 @@ export async function feedInitiativesFromDatabase() {

const initiativeGptTemplate = handlebars.compile(initiativeGptTemplateContent);

const { t } = getServerTranslation('common', {
lng: 'fr',
});

// Since the underlying wappalyzer analysis per initiative map can take some time due to being in a Chromium environment
// we parallelize hoping to save some time. But still, we take in considerations the LLM API rate limit
const iterationLlmManagerApiCalls = 2; // One for the embeddings of the tools, and the other for the computation of the initiative sheet
Expand Down Expand Up @@ -1051,9 +1056,7 @@ export async function feedInitiativesFromDatabase() {
}),
messageToAppend:
failedDueToLlmResponseFormat > 0
? `C'est la ${
failedDueToLlmResponseFormat === 1 ? 'deuxième' : `${failedDueToLlmResponseFormat + 1}ème`
} tentative car la dernière fois tu n'as pas respecté le format JSON attendu !`
? t('llm.template.initiative.responseFormatFailures', { count: failedDueToLlmResponseFormat })

Check failure on line 1059 in src/features/initiative.ts

View workflow job for this annotation

GitHub Actions / Continuous Integration

No overload matches this call.
: undefined,
})
);
Expand Down

0 comments on commit 5bc7d37

Please sign in to comment.