Skip to content

Commit

Permalink
Attempt to prevent hallucinations for websites
Browse files Browse the repository at this point in the history
  • Loading branch information
dcramer committed Jun 27, 2024
1 parent 81b9bf9 commit b8c4d64
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions apps/server/src/jobs/generateEntityDetails.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,23 @@ export default async ({ entityId }: { entityId: number }) => {

if (Object.keys(data).length === 0) return;

if (data.website) {
try {
await fetch(data.website, {
headers: {
"User-Agent": "PeatedBot/1.0 (https://peated.com)",
},
});
} catch (err) {
console.error(
`Discarded website (${data.website}) as possible hallucination`,
err,
);
// dont allow LLMs to hallucinate fake URLs
data.website = null;
}
}

await db.transaction(async (tx) => {
await db.update(entities).set(data).where(eq(entities.id, entity.id));

Expand Down

0 comments on commit b8c4d64

Please sign in to comment.