Contradictions explained
This commit is contained in:
@@ -76,9 +76,11 @@ export class LLMService {
|
||||
}
|
||||
}
|
||||
|
||||
async checkForInnerContradictions(desireSet: DesireSet): Promise<boolean> {
|
||||
async checkForInnerContradictions(desireSet: DesireSet): Promise<string | null> {
|
||||
const prompt = `
|
||||
You are an AI assistant that detects contradictions in a list of desires. Given a JSON object with three lists of desires (wants, accepts, noGoes), determine if there are any contradictions WITHIN each list and across the lists. For example, "I want a dog" and "I don't want any pets" in the same "wants" list is a contradiction; "Pizza" in "wants" and "food" in "do not want" is a contradiction. Respond with only "true" if a contradiction is found, and "false" otherwise.
|
||||
You are an AI assistant that detects contradictions in a list of desires. Given a JSON object with three lists of desires (wants, accepts, noGoes), determine if there are any contradictions WITHIN each list and across the lists. For example, "I want a dog" and "I don't want any pets" in the same "wants" list is a contradiction; "Pizza" in "wants" and "food" in "do not want" is a contradiction.
|
||||
|
||||
If a contradiction is found, respond with a concise, single-sentence description of the contradiction. If no contradiction is found, respond with "null".
|
||||
|
||||
Here is the desire set:
|
||||
${JSON.stringify(desireSet)}
|
||||
@@ -87,8 +89,13 @@ export class LLMService {
|
||||
try {
|
||||
const result = await this.model.generateContent(prompt);
|
||||
const response = result.response;
|
||||
const text = response.text().trim().toLowerCase();
|
||||
return text === 'true';
|
||||
const text = response.text().trim();
|
||||
|
||||
if (text.toLowerCase() === 'null') {
|
||||
return null;
|
||||
} else {
|
||||
return text;
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Error calling Gemini API for contradiction check:", error);
|
||||
throw error;
|
||||
|
||||
Reference in New Issue
Block a user