Use labels in generate_functions

pull/1056/head
Scott Block 4 months ago
parent c945a6164f
commit 137f710445

@ -392,24 +392,24 @@
"outputs": [],
"source": [
"def generate_functions(labels: dict) -> list:\n",
" pattern = r'^(?:' + '|'.join(labels.keys()) + ')$'\n",
" return [\n",
" { \n",
" {\n",
" \"type\": \"function\",\n",
" \"function\": {\n",
" \"name\": \"enrich_entities\",\n",
" \"description\": \"Enrich Text with Knowledge Base Links\",\n",
" \"parameters\": {\n",
" \"type\": \"object\",\n",
" \"properties\": {\n",
" \"r'^(?:' + '|'.join({labels}) + ')$'\": \n",
" {\n",
" \"type\": \"array\",\n",
" \"items\": {\n",
" \"type\": \"string\"\n",
" }\n",
" \"properties\": {\n",
" pattern: {\n",
" \"type\": \"array\",\n",
" \"items\": {\n",
" \"type\": \"string\"\n",
" }\n",
" },\n",
" \"additionalProperties\": False\n",
" }\n",
" },\n",
" \"additionalProperties\": False\n",
" },\n",
" }\n",
" }\n",

Loading…
Cancel
Save