Skip to content

Commit

Permalink
FIX: Make queries more robust
Browse files Browse the repository at this point in the history
  • Loading branch information
sanand0 committed Oct 31, 2024
1 parent 60c2387 commit 039133a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
4 changes: 2 additions & 2 deletions clinicaltrials.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ export const api = {
export const tools = {
studies: {
name: "studies",
description: "Search clinical trials with filters. Use AND, OR, NOT, and parentheses for grouping.",
description: "Search clinical trials with filters.",
parameters: {
type: "object",
required: ["fields"],
properties: {
"query.cond": { type: "string", description: "Search for condition or disease" },
"query.term": {
type: "string",
description: "Search other terms like age, phase, design, sponsor, keyword, etc.",
description: 'Search age, phase, design, sponsor, keyword, etc.',
},
"query.locn": { type: "string", description: "Search for location (country, state, city, facility)" },
"query.titles": { type: "string", description: "Search in title" },
Expand Down
10 changes: 9 additions & 1 deletion script.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,15 @@ $queryForm.addEventListener("submit", async (e) => {
model: "gpt-4o-mini",
stream: true,
messages: [
{ role: "system", content: "Find studies that will have the most relevant answers to the user question" },
{
role: "system",
content: `
Find studies that will have the most relevant answers to the user question.
In query.*, don't use phrases as-is. Always identify the most relevant keywords, combining them with AND.
E.g. "violation by the FDA" becomes "violation AND FDA".
E.g. "improper adherence to safety and scientific integrity" becomes "adherence AND safety AND integrity"
`.trim(),
},
{ role: "user", content: query },
],
tools: [{ type: "function", function: tools.studies }],
Expand Down

0 comments on commit 039133a

Please sign in to comment.