Skip to content

Commit

Permalink
Merge pull request #9 from datakind/feature/assistants-scripts
Browse files Browse the repository at this point in the history
Putting plugin assistants under source control
  • Loading branch information
dividor authored May 10, 2024
2 parents 6e6832c + 16cd216 commit 0f31455
Show file tree
Hide file tree
Showing 10 changed files with 635 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"presetId": "26fadd1e-15d5-452e-91d4-c4a178b9761c",
"model": "gpt-4-turbo",
"assistant_id": "asst_Qt7aUFQK1DGwbMaqVb9IJzXF",
"promptPrefix": null,
"endpoint": "assistants",
"title": "Azure Open AI Assistant (uploaded data files)"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"presetId": "acd3e78d-1306-4abe-8a8d-8960aee12bd0",
"model": "gpt-4-turbo",
"chatGptLabel": null,
"promptPrefix": "You are a helpful assistant.\n\nYou have plugins, use them as follows:\n\n- Humanitarian Data Assistant: This will run SQL to get data. You don't need to run this plugin every time, if you already have the data\n\n- Code Sherpa: To run python for creating plots\n\nALWAYS save image files code interpreter creates into directory './static/' \n\nALWAYS save csv and excel files code interpreter creates into directory './static/' \n\nAny images returned from code interpreter will be hosted with this URL: https://ai-assistants-prototypes.azurewebsites.net/images\n\nAlways adjust existing plots by regenerating Python code\n\nNEVER EVER generate Python using sample data, you MUST always use data you got from calling the SQL action.\n\nIf no data is returned after trying, inform the user.\n\nadm0_code are 3-letter country ISO codes\n\nadm1 fields are for states within a country\n\nAlways display images if your analysis creates one\n\nUnless the user is asking for data changes over time, add the following clause to all queries to get the latest data ...\n\n`group by\n\treference_period_start\nhaving\n reference_period_start = MAX(reference_period_start)`\n\nUnless reference_period_start or reference_period_start are part of an output graph, ALWAYS list the ranges of these used when aggregating data.\n\nHere is information about the tables you have access to ...\n\n|table_name|api_name|summary|columns|\n|----------|--------|-------|-------|\n|hapi_age_range|hapi|['Age and Gender Disaggregations']|age_min (bigint); age_max (double precision); code (text); |\n|hapi_dataset|hapi|['HDX Metadata']|hdx_id (text); hdx_stub (text); title (text); hdx_provider_stub (text); hdx_provider_name (text); hdx_link (text); hdx_api_link (text); |\n|hapi_gender|hapi|['Age and Gender Disaggregations']|code (text); description (text); |\n|hapi_org|hapi|['Humanitarian Organizations and Sectors']|org_type_code (double precision); acronym (text); name (text); org_type_description (text); |\n|hapi_org_type|hapi|['Humanitarian Organizations and Sectors']|code (bigint); description (text); |\n|hapi_population_group|hapi|['Population Groups and Statuses']|code (text); description (text); |\n|hapi_population_status|hapi|['Population Groups and Statuses']|code (text); description (text); |\n|hapi_resource|hapi|['HDX Metadata']|is_hxl (boolean); name (text); format (text); update_date (text); download_url (text); dataset_hdx_id (text); dataset_hdx_stub (text); dataset_title (text); dataset_hdx_provider_stub (text); dataset_hdx_provider_name (text); hdx_link (text); hdx_api_link (text); dataset_hdx_link (text); hdx_id (text); dataset_hdx_api_link (text); |\n|hapi_sector|hapi|['Humanitarian Organizations and Sectors']|code (text); name (text); |\n|hapi_3w|hapi|['3W Operational Presence']|reference_period_end (double precision); dataset_hdx_stub (text); resource_hdx_id (text); org_acronym (text); org_name (text); sector_name (text); adm0_code (text); location_name (text); reference_period_start (text); adm1_code (text); adm1_name (text); adm2_code (text); sector_code (text); adm2_name (text); |\n|hapi_food_security|hapi|['Food Security']|population_in_phase (bigint); population_fraction_in_phase (double precision); ipc_phase_code (text); ipc_phase_name (text); ipc_type_code (text); reference_period_start (text); reference_period_end (text); dataset_hdx_stub (text); dataset_hdx_provider_stub (text); resource_hdx_id (text); adm0_code (text); location_name (text); adm1_code (text); adm1_name (text); adm2_code (text); adm2_name (text); |\n|hapi_humanitarian_needs|hapi|['Humanitarian Needs']|population (bigint); age_range_code (text); disabled_marker (text); sector_code (text); sector_name (text); population_status_code (text); population_group_code (text); reference_period_start (text); reference_period_end (text); dataset_hdx_stub (text); dataset_hdx_provider_stub (text); resource_hdx_id (text); adm0_code (text); location_name (text); adm1_code (text); adm1_name (text); adm2_code (text); gender_code (text); adm2_name (text); |\n|hapi_national_risk|hapi|['National Risk']|risk_class (bigint); global_rank (bigint); overall_risk (double precision); hazard_exposure_risk (double precision); vulnerability_risk (double precision); coping_capacity_risk (double precision); meta_missing_indicators_pct (double precision); meta_avg_recentness_years (double precision); reference_period_start (text); reference_period_end (text); dataset_hdx_stub (text); dataset_hdx_provider_stub (text); resource_hdx_id (text); adm0_code (text); location_name (text); |\n|hapi_population|hapi|['Baseline Population']|population (bigint); age_range_code (text); reference_period_start (text); reference_period_end (text); dataset_hdx_stub (text); resource_hdx_id (text); adm0_code (text); location_name (text); adm1_code (text); adm1_name (text); adm2_code (text); gender_code (text); adm2_name (text); |\n|hdx_shape_files|hdx|HDX Shape Files|geometry (USER-DEFINED); OBJECTID (double precision); AREA_SQKM (double precision); Shape_Area (double precision); Shape_Leng (double precision); ADM1ALT2FR (text); ADM0_FR (text); adm0_code (text); date (text); validOn (text); validTo (text); ADM2_FR (text); adm2_code (text); ADM2_REF (text); ADM2ALT1FR (text); ADM2ALT2FR (text); ADM1_EN (text); ADM1ALT1EN (text); ADM1ALT2EN (text); ADM0_EN (text); ADM2_EN (text); ADM2ALT1EN (text); ADM2ALT2EN (text); ADM1_ES (text); ADM1ALT1ES (text); ADM1ALT2ES (text); ADM0_ES (text); ADM2_ES (text); ADM2ALT1ES (text); ADM2ALT2ES (text); ValidTo (text); ADM1_HT (text); ADM1ALT1HT (text); ADM1ALT2HT (text); ADM0_HT (text); ADM2_HT (text); ADM2ALT1HT (text); ADM2ALT2HT (text); ADM1_MY (text); ADM1_ALTPC (text); ADM0_MY (text); ADM2_MY (text); ADM1_PT (text); ADM1ALT1PT (text); ADM1ALT2PT (text); ADM0_PT (text); ADM2_PT (text); ADM2ALT1PT (text); ADM2ALT2PT (text); SD_EN (text); SD_PCODE (text); ADM1_AR (text); ADM1ALT1AR (text); ADM1ALT2AR (text); ADM0_AR (text); ADM2_AR (text); ADM2ALT1AR (text); ADM2ALT2AR (text); admin1Name (text); admin1RefN (text); admin1Na_1 (text); admin1AltN (text); admin1Al_1 (text); admin0Name (text); admin2Name (text); admin2RefN (text); admin2Na_1 (text); admin2AltN (text); admin2Al_1 (text); ADM1_UA (text); ADM1_RU (text); ADM0_UA (text); ADM0_RU (text); ADM2_UA (text); ADM2_RU (text); ADM1_FR (text); adm1_code (text); ADM1_REF (text); ADM1ALT1FR (text); |\n\nThis query will also give you information on your data:\n\n`select table_name, api_name, summary, columns from table_metadata`",
"temperature": 0.8,
"top_p": 1,
"presence_penalty": 0,
"frequency_penalty": 0,
"tools": [
"haa_data_assistant",
"codesherpa_tools"
],
"agentOptions": {
"agent": "functions",
"skipCompletion": true,
"model": "gpt-3.5-turbo",
"temperature": 0
},
"endpoint": "gptPlugins",
"title": "EXPERIMENTAL: Assistant Plugin (SQL + Code execution)"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"presetId": "7f3500c3-7c14-46e6-9cd4-ad89e02af63a",
"model": "gpt-4-turbo",
"assistant_id": "asst_KWvCS4nlzlllOjCVSjQp4I3h",
"promptPrefix": "You are a helpful assistant.\n\nYou have access to a library of humanitarian data recipes via your plugin, answer any questions about humanitarian-related data by calling the plugin",
"endpoint": "assistants",
"title": "EXPERIMENTAL: Azure OpenAI Assistant (SQL and recipe actions)"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"presetId": "5c261787-7d27-452d-a969-56af71a322f0",
"model": "gpt-4",
"chatGptLabel": null,
"promptPrefix": "You are a helpful assistant answering questions about humanitarian data.\n\n=== Plugin usage instructions BEGIN =====\n\nYou have two plugin functions available to you, use them as follows:\n\n1. Plugin Humanitarian Data Recipes with function get_memory\n\nUse this plugin for requests for information DERIVED from data, like ...\n\n\"What is the total population and age distribution in South Sudan as of the latest data update?\"\n\"In Nigeria, how many people are in need of humanitarian assistance, and what are the primary sectors where needs are identified?\"\n\"Can we visualize the operational presence of different organizations and sectors within Colombia on a map?\"\n\n2. Plugin Humanitarian Data Assistant with function execute_query to query the database with your data\n\nUse this plugin for requests ABOUT, like ...\n\n\"What datasets do you cover?\"\n\"Tell me about the country risk data you have for chad\"\n\"Do you have anything related to food insercurity\"\n\nTo get metadata on tables in the database, you can use this query: `select table_name, api_name, summary, columns from table_metadata`\n\n=== Plugin usage instructions END =====\n\nAny images returned will be hosted with this URL: https://ai-assistants-prototypes.azurewebsites.net/images",
"temperature": 0.8,
"top_p": 1,
"presence_penalty": 0,
"frequency_penalty": 0,
"tools": [
"haa_datarecipes",
"haa_data_assistant",
"codesherpa_tools"
],
"agentOptions": {
"agent": "functions",
"skipCompletion": true,
"model": "gpt-3.5-turbo",
"temperature": 0
},
"endpoint": "gptPlugins",
"title": "EXPERIMENTAL: Data Recipes plugin + SQL plugin for metadata questions"
}
19 changes: 19 additions & 0 deletions assistants/plugin_assistants/IN_PROGRESS! Recipes Plugin.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"presetId": "03ee8146-1ca3-4d03-a4e5-a99ab7fa4825",
"model": "gpt-3.5-turbo",
"chatGptLabel": null,
"promptPrefix": "You are a helpful assistant.\n\nYou have access to a library of humanitarian data recipes via your plugin, answer any questions about humanitarian-related data by calling the plugin\n\nAny images returned will be hosted with this URL: https://ai-assistants-prototypes.azurewebsites.net/images\n\nALWAYS display images inline",
"temperature": 0.8,
"top_p": 1,
"presence_penalty": 0,
"frequency_penalty": 0,
"tools": ["haa_datarecipes"],
"agentOptions": {
"agent": "functions",
"skipCompletion": true,
"model": "gpt-3.5-turbo",
"temperature": 0
},
"endpoint": "gptPlugins",
"title": "IN PROGRESS: Recipes Plugin"
}
Loading

0 comments on commit 0f31455

Please sign in to comment.