{"version":3,"file":"prompt.cjs","names":["PromptTemplate"],"sources":["../../../src/chains/query_constructor/prompt.ts"],"sourcesContent":["import { PromptTemplate } from \"@langchain/core/prompts\";\n\nexport const SONG_DATA_SOURCE = `\\\n\\`\\`\\`json\n{\n    \"content\": \"Lyrics of a song\",\n    \"attributes\": {\n        \"artist\": {\n            \"type\": \"string\",\n            \"description\": \"Name of the song artist\"\n        },\n        \"length\": {\n            \"type\": \"integer\",\n            \"description\": \"Length of the song in seconds\"\n        },\n        \"genre\": {\n            \"type\": \"string\",\n            \"description\": \"The song genre, one of 'pop', 'rock' or 'rap'\"\n        }\n    }\n}\n\\`\\`\\`\\\n`\n  .replaceAll(\"{\", \"{{\")\n  .replaceAll(\"}\", \"}}\");\n\nexport const FULL_ANSWER = `\\\n\\`\\`\\`json\n{{\n    \"query\": \"teenager love\",\n    \"filter\": \"and(or(eq(\\\\\"artist\\\\\", \\\\\"Taylor Swift\\\\\"), eq(\\\\\"artist\\\\\", \\\\\"Katy Perry\\\\\")), \\\nlt(\\\\\"length\\\\\", 180), eq(\\\\\"genre\\\\\", \\\\\"pop\\\\\"))\"\n}}`;\n\nexport const NO_FILTER_ANSWER = `\\\n\\`\\`\\`json\n{{\n    \"query\": \"\",\n    \"filter\": \"NO_FILTER\"\n}}\n\\`\\`\\`\\\n`;\n\nexport const DEFAULT_EXAMPLES = [\n  {\n    i: \"1\",\n    data_source: SONG_DATA_SOURCE,\n    user_query:\n      \"What are songs by Taylor Swift or Katy Perry about teenage romance under 3 minutes long in the dance pop genre\",\n    structured_request: FULL_ANSWER,\n  },\n  {\n    i: \"2\",\n    data_source: SONG_DATA_SOURCE,\n    user_query: \"What are songs that were not published on Spotify\",\n    structured_request: NO_FILTER_ANSWER,\n  },\n];\n\nexport const EXAMPLE_PROMPT_TEMPLATE = `\\\n<< Example {i}. >>\nData Source:\n{data_source}\n\nUser Query:\n{user_query}\n\nStructured Request:\n{structured_request}\n`;\n\nexport const EXAMPLE_PROMPT = /* #__PURE__ */ new PromptTemplate({\n  inputVariables: [\"i\", \"data_source\", \"user_query\", \"structured_request\"],\n  template: EXAMPLE_PROMPT_TEMPLATE,\n});\n\nexport const DEFAULT_SCHEMA = `\\\n<< Structured Request Schema >>\nWhen responding use a markdown code snippet with a JSON object formatted in the \\\nfollowing schema:\n\n\\`\\`\\`json\n{{{{\n    \"query\": string \\\\ text string to compare to document contents\n    \"filter\": string \\\\ logical condition statement for filtering documents\n}}}}\n\\`\\`\\`\n\nThe query string should contain only text that is expected to match the contents of \\\ndocuments. Any conditions in the filter should not be mentioned in the query as well.\n\nA logical condition statement is composed of one or more comparison and logical \\\noperation statements.\n\nA comparison statement takes the form: \\`comp(attr, val)\\`:\n- \\`comp\\` ({allowed_comparators}): comparator\n- \\`attr\\` (string):  name of attribute to apply the comparison to\n- \\`val\\` (string): is the comparison value\n\nA logical operation statement takes the form \\`op(statement1, statement2, ...)\\`:\n- \\`op\\` ({allowed_operators}): logical operator\n- \\`statement1\\`, \\`statement2\\`, ... (comparison statements or logical operation \\\nstatements): one or more statements to apply the operation to\n\nMake sure that you only use the comparators and logical operators listed above and \\\nno others.\nMake sure that filters only refer to attributes that exist in the data source.\nMake sure that filters only use the attributed names with its function names if there are functions applied on them.\nMake sure that filters only use format \\`YYYY-MM-DD\\` when handling timestamp data typed values.\nMake sure that filters take into account the descriptions of attributes and only make \\\ncomparisons that are feasible given the type of data being stored.\nMake sure that filters are only used as needed. If there are no filters that should be \\\napplied return \"NO_FILTER\" for the filter value.\\\n`;\n\nexport const DEFAULT_PREFIX = `\\\nYour goal is to structure the user's query to match the request schema provided below.\n\n{schema}\\\n`;\n\nexport const DEFAULT_SUFFIX = `\\\n<< Example {i}. >>\nData Source:\n\\`\\`\\`json\n{{{{\n    \"content\": \"{content}\",\n    \"attributes\": {attributes}\n}}}}\n\\`\\`\\`\n\nUser Query:\n{{query}}\n\nStructured Request:\n`;\n"],"mappings":";;;AAEA,MAAa,mBAAmB;;;;;;;;;;;;;;;;;;;;EAqB7B,WAAW,KAAK,KAAK,CACrB,WAAW,KAAK,KAAK;AAmBxB,MAAa,mBAAmB,CAC9B;CACE,GAAG;CACH,aAAa;CACb,YACE;CACF,oBAvBuB;;;;;;;CAwBxB,EACD;CACE,GAAG;CACH,aAAa;CACb,YAAY;CACZ,oBArB4B;;;;;;;;CAsB7B,CACF;AAcD,MAAa,iCAAiC,IAAIA,wBAAAA,eAAe;CAC/D,gBAAgB;EAAC;EAAK;EAAe;EAAc;EAAqB;CACxE,UAdqC;;;;;;;;;;;CAetC,CAAC;AAEF,MAAa,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuC9B,MAAa,iBAAiB;;;;;AAM9B,MAAa,iBAAiB"}