-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwith-observation.jsonl
More file actions
24 lines (24 loc) · 465 KB
/
with-observation.jsonl
File metadata and controls
24 lines (24 loc) · 465 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
{"messages": [{"role": "system", "content": "You are a text-to-sql generator. You have a database of marine species. The sql should be generated in a way such that the response from sql is a json. "}, {"role": "user", "content": "\n The database has the following structure.\n\n CREATE TABLE \"dbo\".\"bounding_box_comments\" (\n \"id\" \tbigint NOT NULL,\n \"bounding_box_uuid\" \tuniqueidentifier NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"email\" \tvarchar(254) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"text\" \tvarchar(2048) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"alternate_concept\" \tvarchar(255) NULL,\n \"flagged\" \tbit NULL,\n CONSTRAINT \"PK__bounding__3213E83F71625CCD\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"bounding_boxes\" (\n \"id\" \tbigint NOT NULL,\n \"concept\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"group_of\" \tbit NULL,\n \"height\" \tint NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"observer\" \tvarchar(256) NULL,\n \"occluded\" \tbit NULL,\n \"truncated\" \tbit NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"verification_timestamp\"\tdatetimeoffset(6) NULL,\n \"verified\" \tbit NULL,\n \"verifier\" \tvarchar(256) NULL,\n \"width\" \tint NULL,\n \"x\" \tint NULL,\n \"y\" \tint NULL,\n \"image_id\" \tbigint NULL,\n \"alt_concept\" \tvarchar(255) NULL,\n \"user_defined_key\" \tvarchar(56) NULL,\n CONSTRAINT \"PK__bounding__3213E83F3E4C2D08\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"bounding_boxes_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"concept\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"group_of\" \tbit NULL,\n \"height\" \tint NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"observer\" \tvarchar(256) NULL,\n \"occluded\" \tbit NULL,\n \"truncated\" \tbit NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"verification_timestamp\"\tdatetimeoffset(6) NULL,\n \"verified\" \tbit NULL,\n \"verifier\" \tvarchar(256) NULL,\n \"width\" \tint NULL,\n \"x\" \tint NULL,\n \"y\" \tint NULL,\n \"image_id\" \tbigint NULL,\n \"alt_concept\" \tvarchar(255) NULL,\n \"user_defined_key\" \tvarchar(56) NULL,\n CONSTRAINT \"PK__bounding__BE3894F99D30F28A\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"darwin_cores\" (\n \"id\" \tbigint NOT NULL,\n \"access_rights\" \tvarchar(1024) NULL,\n \"basis_of_record\" \tvarchar(64) NULL,\n \"bibliographic_citation\"\tvarchar(512) NULL,\n \"collection_code\" \tvarchar(64) NULL,\n \"collection_id\" \tvarchar(2048) NULL,\n \"data_generalizations\" \tvarchar(512) NULL,\n \"dataset_id\" \tuniqueidentifier NULL,\n \"dataset_name\" \tvarchar(255) NULL,\n \"dynamic_properties\" \tvarchar(2048) NULL,\n \"information_withheld\" \tvarchar(255) NULL,\n \"institution_code\" \tvarchar(255) NULL,\n \"institution_id\" \tvarchar(255) NULL,\n \"license\" \tvarchar(2048) NULL,\n \"modified\" \tdatetimeoffset(6) NULL,\n \"owner_institution_code\"\tvarchar(255) NULL,\n \"record_language\" \tvarchar(35) NULL,\n \"record_references\" \tvarchar(2048) NULL,\n \"record_type\" \tvarchar(32) NULL,\n \"rights_holder\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"image_set_upload_id\" \tbigint NULL,\n CONSTRAINT \"PK__darwin_c__3213E83F92DAE497\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"fathomnet_identities\" (\n \"id\" \tbigint NOT NULL,\n \"api_key\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"disabled\" \tbit NULL,\n \"display_name\" \tvarchar(255) NULL,\n \"email\" \tvarchar(255) NULL,\n \"expertise_rank\" \tvarchar(32) NULL,\n \"firebase_uid\" \tvarchar(255) NULL,\n \"job_title\" \tvarchar(255) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"organization\" \tvarchar(255) NULL,\n \"profile\" \tvarchar(1024) NULL,\n \"role_data\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"avatar_url\" \tvarchar(2000) NULL,\n \"orcid\" \tvarchar(32) NULL,\n \"notification_frequency\"\tvarchar(32) NULL,\n CONSTRAINT \"PK__fathomne__3213E83F59FE1468\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"fathomnet_identities_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"api_key\" \tvarchar(255) NULL,\n \"avatar_url\" \tvarchar(2000) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"disabled\" \tbit NULL,\n \"display_name\" \tvarchar(255) NULL,\n \"email\" \tvarchar(254) NULL,\n \"expertise_rank\" \tvarchar(32) NULL,\n \"firebase_uid\" \tvarchar(64) NULL,\n \"job_title\" \tvarchar(255) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"orcid\" \tvarchar(32) NULL,\n \"organization\" \tvarchar(255) NULL,\n \"profile\" \tvarchar(1024) NULL,\n \"role_data\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"notification_frequency\"\tvarchar(32) NULL,\n CONSTRAINT \"PK__fathomne__BE3894F9CD98EF78\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"followed_topics\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"email\" \tvarchar(254) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"notification\" \tbit NULL,\n \"target\" \tvarchar(256) NULL,\n \"topic\" \tvarchar(32) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n CONSTRAINT \"PK__followed__3213E83F4A1EA9E0\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"image_set_uploads\" (\n \"id\" \tbigint NOT NULL,\n \"contributors_email\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"format\" \tvarchar(255) NULL,\n \"last_updated_timestamp\" \tdatetime2(6) NULL,\n \"local_path\" \tvarchar(2048) NULL,\n \"rejection_details\" \tvarchar(255) NULL,\n \"rejection_reason\" \tvarchar(255) NULL,\n \"remote_uri\" \tvarchar(2048) NULL,\n \"sha256\" \tvarchar(64) NULL,\n \"status\" \tvarchar(255) NULL,\n \"status_update_timestamp\"\tdatetimeoffset(6) NULL,\n \"status_updater_email\" \tvarchar(254) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"darwincore_id\" \tbigint NULL,\n CONSTRAINT \"PK__image_se__3213E83F9C72A0E9\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"image_uploads_join\" (\n \"imagesetupload_id\"\tbigint NOT NULL,\n \"image_id\" \tbigint NOT NULL,\n CONSTRAINT \"PK__image_up__8A53EE0EBD9D776A\" PRIMARY KEY CLUSTERED(\"imagesetupload_id\",\"image_id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"images\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"depth_meters\" \tfloat NULL,\n \"height\" \tint NULL,\n \"imaging_type\" \tvarchar(64) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"last_validation\" \tdatetimeoffset(6) NULL,\n \"latitude\" \tfloat NULL,\n \"longitude\" \tfloat NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"modified\" \tdatetimeoffset(6) NULL,\n \"sha256\" \tvarchar(64) NULL,\n \"submitter\" \tvarchar(255) NULL,\n \"timestamp\" \tdatetimeoffset(6) NULL,\n \"url\" \tvarchar(2048) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"valid\" \tbit NULL,\n \"width\" \tint NULL,\n \"contributors_email\" \tvarchar(254) NULL,\n \"altitude\" \tfloat NULL,\n \"oxygen_ml_l\" \tfloat NULL,\n \"pressure_dbar\" \tfloat NULL,\n \"salinity\" \tfloat NULL,\n \"temperature_celsius\" \tfloat NULL,\n CONSTRAINT \"PK__images__3213E83FD76E309F\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"images_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"contributors_email\" \tvarchar(254) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"depth_meters\" \tfloat NULL,\n \"height\" \tint NULL,\n \"imaging_type\" \tvarchar(64) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"last_validation\" \tdatetimeoffset(6) NULL,\n \"latitude\" \tfloat NULL,\n \"longitude\" \tfloat NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"modified\" \tdatetimeoffset(6) NULL,\n \"sha256\" \tvarchar(64) NULL,\n \"timestamp\" \tdatetimeoffset(6) NULL,\n \"url\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"valid\" \tbit NULL,\n \"width\" \tint NULL,\n \"altitude\" \tfloat NULL,\n \"oxygen_ml_l\" \tfloat NULL,\n \"pressure_dbar\" \tfloat NULL,\n \"salinity\" \tfloat NULL,\n \"temperature_celsius\" \tfloat NULL,\n CONSTRAINT \"PK__images_a__BE3894F92DF6715C\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"marine_regions\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2 NULL,\n \"last_updated_timestamp\"\tdatetime2 NULL,\n \"max_latitude\" \tfloat NOT NULL,\n \"max_longitude\" \tfloat NOT NULL,\n \"min_latitude\" \tfloat NOT NULL,\n \"min_longitude\" \tfloat NOT NULL,\n \"mrgid\" \tbigint NULL,\n \"name\" \tvarchar(255) NULL,\n CONSTRAINT \"PK__marine_r__3213E83FE987FC8B\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"revinfo\" (\n \"rev\" \tint IDENTITY(1,1) NOT NULL,\n \"revtstmp\"\tbigint NULL,\n CONSTRAINT \"PK__revinfo__C2B7CC69D3938648\" PRIMARY KEY CLUSTERED(\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"tags\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2 NULL,\n \"tag\" \tvarchar(255) NOT NULL,\n \"last_updated_timestamp\"\tdatetime2 NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"value\" \tvarchar(255) NOT NULL,\n \"image_id\" \tbigint NULL,\n CONSTRAINT \"PK__tags__3213E83F3A490684\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"tags_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"created_timestamp\" \tdatetime2 NULL,\n \"tag\" \tvarchar(255) NULL,\n \"last_updated_timestamp\"\tdatetime2 NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"value\" \tvarchar(255) NULL,\n \"image_id\" \tbigint NULL,\n CONSTRAINT \"PK__tags_aud__BE3894F94F1608A8\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE VIEW \"dbo\".\"boundingbox_extended_info\" AS\n SELECT\n b.concept,\n b.alt_concept,\n b.observer,\n b.verified,\n b.verifier,\n b.verification_timestamp,\n b.user_defined_key,\n i.url,\n i.width,\n i.height,\n i.submitter,\n i.[timestamp],\n i.contributors_email AS image_contributors_email,\n u.contributors_email AS upload_contributors_email,\n dc.owner_institution_code,\n dc.institution_code,\n dc.rights_holder,\n dc.collection_code,\n dc.collection_id,\n dc.dataset_name\n FROM\n dbo.darwin_cores dc LEFT JOIN\n dbo.image_set_uploads u ON dc.id = u.darwincore_id LEFT JOIN\n dbo.image_uploads_join j ON j.imagesetupload_id = u.id LEFT JOIN\n dbo.images i ON j.image_id = i.id LEFT JOIN\n dbo.bounding_boxes b ON b.image_id = i.id\n ;\n\n First generate the observation from the prompt and how will you generate thq query, then only generate the prompt. Make sure the sql query is inside ```\n If the prompt is asking about species or images of individual species, draft the sql in such a way that it generates json array containing the species data. Species data must contain species concept and bounding box id as id.\n\n Prompt: Find me images of Aurelia aurita"}, {"role": "assistant", "content": "Observation:To find the images from the database so you need to format the output such that it is a json and has species array that has species concept as concept, image url as url, image id as image_id and species bounding box id as id\nSince the prompt does not specify number of images. Limit the query to top 10 images\nSql Query:```SELECT TOP 10 i.url, i.id as image_id, b.concept, b.id\nFROM images i\nJOIN bounding_boxes b ON i.id = b.image_id\nWHERE b.concept = 'Aurelia aurita'\nFOR JSON PATH```"}]}
{"messages": [{"role": "system", "content": "You are a text-to-sql generator. You have a database of marine species. The sql should be generated in a way such that the response from sql is a json. "}, {"role": "user", "content": "\n The database has the following structure.\n\n CREATE TABLE \"dbo\".\"bounding_box_comments\" (\n \"id\" \tbigint NOT NULL,\n \"bounding_box_uuid\" \tuniqueidentifier NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"email\" \tvarchar(254) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"text\" \tvarchar(2048) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"alternate_concept\" \tvarchar(255) NULL,\n \"flagged\" \tbit NULL,\n CONSTRAINT \"PK__bounding__3213E83F71625CCD\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"bounding_boxes\" (\n \"id\" \tbigint NOT NULL,\n \"concept\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"group_of\" \tbit NULL,\n \"height\" \tint NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"observer\" \tvarchar(256) NULL,\n \"occluded\" \tbit NULL,\n \"truncated\" \tbit NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"verification_timestamp\"\tdatetimeoffset(6) NULL,\n \"verified\" \tbit NULL,\n \"verifier\" \tvarchar(256) NULL,\n \"width\" \tint NULL,\n \"x\" \tint NULL,\n \"y\" \tint NULL,\n \"image_id\" \tbigint NULL,\n \"alt_concept\" \tvarchar(255) NULL,\n \"user_defined_key\" \tvarchar(56) NULL,\n CONSTRAINT \"PK__bounding__3213E83F3E4C2D08\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"bounding_boxes_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"concept\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"group_of\" \tbit NULL,\n \"height\" \tint NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"observer\" \tvarchar(256) NULL,\n \"occluded\" \tbit NULL,\n \"truncated\" \tbit NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"verification_timestamp\"\tdatetimeoffset(6) NULL,\n \"verified\" \tbit NULL,\n \"verifier\" \tvarchar(256) NULL,\n \"width\" \tint NULL,\n \"x\" \tint NULL,\n \"y\" \tint NULL,\n \"image_id\" \tbigint NULL,\n \"alt_concept\" \tvarchar(255) NULL,\n \"user_defined_key\" \tvarchar(56) NULL,\n CONSTRAINT \"PK__bounding__BE3894F99D30F28A\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"darwin_cores\" (\n \"id\" \tbigint NOT NULL,\n \"access_rights\" \tvarchar(1024) NULL,\n \"basis_of_record\" \tvarchar(64) NULL,\n \"bibliographic_citation\"\tvarchar(512) NULL,\n \"collection_code\" \tvarchar(64) NULL,\n \"collection_id\" \tvarchar(2048) NULL,\n \"data_generalizations\" \tvarchar(512) NULL,\n \"dataset_id\" \tuniqueidentifier NULL,\n \"dataset_name\" \tvarchar(255) NULL,\n \"dynamic_properties\" \tvarchar(2048) NULL,\n \"information_withheld\" \tvarchar(255) NULL,\n \"institution_code\" \tvarchar(255) NULL,\n \"institution_id\" \tvarchar(255) NULL,\n \"license\" \tvarchar(2048) NULL,\n \"modified\" \tdatetimeoffset(6) NULL,\n \"owner_institution_code\"\tvarchar(255) NULL,\n \"record_language\" \tvarchar(35) NULL,\n \"record_references\" \tvarchar(2048) NULL,\n \"record_type\" \tvarchar(32) NULL,\n \"rights_holder\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"image_set_upload_id\" \tbigint NULL,\n CONSTRAINT \"PK__darwin_c__3213E83F92DAE497\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"fathomnet_identities\" (\n \"id\" \tbigint NOT NULL,\n \"api_key\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"disabled\" \tbit NULL,\n \"display_name\" \tvarchar(255) NULL,\n \"email\" \tvarchar(255) NULL,\n \"expertise_rank\" \tvarchar(32) NULL,\n \"firebase_uid\" \tvarchar(255) NULL,\n \"job_title\" \tvarchar(255) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"organization\" \tvarchar(255) NULL,\n \"profile\" \tvarchar(1024) NULL,\n \"role_data\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"avatar_url\" \tvarchar(2000) NULL,\n \"orcid\" \tvarchar(32) NULL,\n \"notification_frequency\"\tvarchar(32) NULL,\n CONSTRAINT \"PK__fathomne__3213E83F59FE1468\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"fathomnet_identities_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"api_key\" \tvarchar(255) NULL,\n \"avatar_url\" \tvarchar(2000) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"disabled\" \tbit NULL,\n \"display_name\" \tvarchar(255) NULL,\n \"email\" \tvarchar(254) NULL,\n \"expertise_rank\" \tvarchar(32) NULL,\n \"firebase_uid\" \tvarchar(64) NULL,\n \"job_title\" \tvarchar(255) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"orcid\" \tvarchar(32) NULL,\n \"organization\" \tvarchar(255) NULL,\n \"profile\" \tvarchar(1024) NULL,\n \"role_data\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"notification_frequency\"\tvarchar(32) NULL,\n CONSTRAINT \"PK__fathomne__BE3894F9CD98EF78\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"followed_topics\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"email\" \tvarchar(254) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"notification\" \tbit NULL,\n \"target\" \tvarchar(256) NULL,\n \"topic\" \tvarchar(32) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n CONSTRAINT \"PK__followed__3213E83F4A1EA9E0\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"image_set_uploads\" (\n \"id\" \tbigint NOT NULL,\n \"contributors_email\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"format\" \tvarchar(255) NULL,\n \"last_updated_timestamp\" \tdatetime2(6) NULL,\n \"local_path\" \tvarchar(2048) NULL,\n \"rejection_details\" \tvarchar(255) NULL,\n \"rejection_reason\" \tvarchar(255) NULL,\n \"remote_uri\" \tvarchar(2048) NULL,\n \"sha256\" \tvarchar(64) NULL,\n \"status\" \tvarchar(255) NULL,\n \"status_update_timestamp\"\tdatetimeoffset(6) NULL,\n \"status_updater_email\" \tvarchar(254) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"darwincore_id\" \tbigint NULL,\n CONSTRAINT \"PK__image_se__3213E83F9C72A0E9\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"image_uploads_join\" (\n \"imagesetupload_id\"\tbigint NOT NULL,\n \"image_id\" \tbigint NOT NULL,\n CONSTRAINT \"PK__image_up__8A53EE0EBD9D776A\" PRIMARY KEY CLUSTERED(\"imagesetupload_id\",\"image_id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"images\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"depth_meters\" \tfloat NULL,\n \"height\" \tint NULL,\n \"imaging_type\" \tvarchar(64) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"last_validation\" \tdatetimeoffset(6) NULL,\n \"latitude\" \tfloat NULL,\n \"longitude\" \tfloat NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"modified\" \tdatetimeoffset(6) NULL,\n \"sha256\" \tvarchar(64) NULL,\n \"submitter\" \tvarchar(255) NULL,\n \"timestamp\" \tdatetimeoffset(6) NULL,\n \"url\" \tvarchar(2048) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"valid\" \tbit NULL,\n \"width\" \tint NULL,\n \"contributors_email\" \tvarchar(254) NULL,\n \"altitude\" \tfloat NULL,\n \"oxygen_ml_l\" \tfloat NULL,\n \"pressure_dbar\" \tfloat NULL,\n \"salinity\" \tfloat NULL,\n \"temperature_celsius\" \tfloat NULL,\n CONSTRAINT \"PK__images__3213E83FD76E309F\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"images_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"contributors_email\" \tvarchar(254) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"depth_meters\" \tfloat NULL,\n \"height\" \tint NULL,\n \"imaging_type\" \tvarchar(64) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"last_validation\" \tdatetimeoffset(6) NULL,\n \"latitude\" \tfloat NULL,\n \"longitude\" \tfloat NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"modified\" \tdatetimeoffset(6) NULL,\n \"sha256\" \tvarchar(64) NULL,\n \"timestamp\" \tdatetimeoffset(6) NULL,\n \"url\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"valid\" \tbit NULL,\n \"width\" \tint NULL,\n \"altitude\" \tfloat NULL,\n \"oxygen_ml_l\" \tfloat NULL,\n \"pressure_dbar\" \tfloat NULL,\n \"salinity\" \tfloat NULL,\n \"temperature_celsius\" \tfloat NULL,\n CONSTRAINT \"PK__images_a__BE3894F92DF6715C\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"marine_regions\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2 NULL,\n \"last_updated_timestamp\"\tdatetime2 NULL,\n \"max_latitude\" \tfloat NOT NULL,\n \"max_longitude\" \tfloat NOT NULL,\n \"min_latitude\" \tfloat NOT NULL,\n \"min_longitude\" \tfloat NOT NULL,\n \"mrgid\" \tbigint NULL,\n \"name\" \tvarchar(255) NULL,\n CONSTRAINT \"PK__marine_r__3213E83FE987FC8B\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"revinfo\" (\n \"rev\" \tint IDENTITY(1,1) NOT NULL,\n \"revtstmp\"\tbigint NULL,\n CONSTRAINT \"PK__revinfo__C2B7CC69D3938648\" PRIMARY KEY CLUSTERED(\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"tags\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2 NULL,\n \"tag\" \tvarchar(255) NOT NULL,\n \"last_updated_timestamp\"\tdatetime2 NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"value\" \tvarchar(255) NOT NULL,\n \"image_id\" \tbigint NULL,\n CONSTRAINT \"PK__tags__3213E83F3A490684\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"tags_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"created_timestamp\" \tdatetime2 NULL,\n \"tag\" \tvarchar(255) NULL,\n \"last_updated_timestamp\"\tdatetime2 NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"value\" \tvarchar(255) NULL,\n \"image_id\" \tbigint NULL,\n CONSTRAINT \"PK__tags_aud__BE3894F94F1608A8\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE VIEW \"dbo\".\"boundingbox_extended_info\" AS\n SELECT\n b.concept,\n b.alt_concept,\n b.observer,\n b.verified,\n b.verifier,\n b.verification_timestamp,\n b.user_defined_key,\n i.url,\n i.width,\n i.height,\n i.submitter,\n i.[timestamp],\n i.contributors_email AS image_contributors_email,\n u.contributors_email AS upload_contributors_email,\n dc.owner_institution_code,\n dc.institution_code,\n dc.rights_holder,\n dc.collection_code,\n dc.collection_id,\n dc.dataset_name\n FROM\n dbo.darwin_cores dc LEFT JOIN\n dbo.image_set_uploads u ON dc.id = u.darwincore_id LEFT JOIN\n dbo.image_uploads_join j ON j.imagesetupload_id = u.id LEFT JOIN\n dbo.images i ON j.image_id = i.id LEFT JOIN\n dbo.bounding_boxes b ON b.image_id = i.id\n ;\n\n First generate the observation from the prompt and how will you generate thq query, then only generate the prompt. Make sure the sql query is inside ```\n If the prompt is asking about species or images of individual species, draft the sql in such a way that it generates json array containing the species data. Species data must contain species concept and bounding box id as id.\n\n Prompt: What is the maximum and minumum latitude and longitude of Atlantic Ocean"}, {"role": "assistant", "content": "Observation:The prompt asks to find maximum and minumum latitude and longitude of Atlantic Ocean. It can be found based on the marine_regions table\nSql Query:```SELECT min_latitude, min_longitude, max_latitude, max_longitude\nFrom marine_regions WHERE name = 'Atlantic Ocean'```"}]}
{"messages": [{"role": "system", "content": "You are a text-to-sql generator. You have a database of marine species. The sql should be generated in a way such that the response from sql is a json. "}, {"role": "user", "content": "\n The database has the following structure.\n\n CREATE TABLE \"dbo\".\"bounding_box_comments\" (\n \"id\" \tbigint NOT NULL,\n \"bounding_box_uuid\" \tuniqueidentifier NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"email\" \tvarchar(254) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"text\" \tvarchar(2048) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"alternate_concept\" \tvarchar(255) NULL,\n \"flagged\" \tbit NULL,\n CONSTRAINT \"PK__bounding__3213E83F71625CCD\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"bounding_boxes\" (\n \"id\" \tbigint NOT NULL,\n \"concept\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"group_of\" \tbit NULL,\n \"height\" \tint NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"observer\" \tvarchar(256) NULL,\n \"occluded\" \tbit NULL,\n \"truncated\" \tbit NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"verification_timestamp\"\tdatetimeoffset(6) NULL,\n \"verified\" \tbit NULL,\n \"verifier\" \tvarchar(256) NULL,\n \"width\" \tint NULL,\n \"x\" \tint NULL,\n \"y\" \tint NULL,\n \"image_id\" \tbigint NULL,\n \"alt_concept\" \tvarchar(255) NULL,\n \"user_defined_key\" \tvarchar(56) NULL,\n CONSTRAINT \"PK__bounding__3213E83F3E4C2D08\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"bounding_boxes_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"concept\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"group_of\" \tbit NULL,\n \"height\" \tint NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"observer\" \tvarchar(256) NULL,\n \"occluded\" \tbit NULL,\n \"truncated\" \tbit NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"verification_timestamp\"\tdatetimeoffset(6) NULL,\n \"verified\" \tbit NULL,\n \"verifier\" \tvarchar(256) NULL,\n \"width\" \tint NULL,\n \"x\" \tint NULL,\n \"y\" \tint NULL,\n \"image_id\" \tbigint NULL,\n \"alt_concept\" \tvarchar(255) NULL,\n \"user_defined_key\" \tvarchar(56) NULL,\n CONSTRAINT \"PK__bounding__BE3894F99D30F28A\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"darwin_cores\" (\n \"id\" \tbigint NOT NULL,\n \"access_rights\" \tvarchar(1024) NULL,\n \"basis_of_record\" \tvarchar(64) NULL,\n \"bibliographic_citation\"\tvarchar(512) NULL,\n \"collection_code\" \tvarchar(64) NULL,\n \"collection_id\" \tvarchar(2048) NULL,\n \"data_generalizations\" \tvarchar(512) NULL,\n \"dataset_id\" \tuniqueidentifier NULL,\n \"dataset_name\" \tvarchar(255) NULL,\n \"dynamic_properties\" \tvarchar(2048) NULL,\n \"information_withheld\" \tvarchar(255) NULL,\n \"institution_code\" \tvarchar(255) NULL,\n \"institution_id\" \tvarchar(255) NULL,\n \"license\" \tvarchar(2048) NULL,\n \"modified\" \tdatetimeoffset(6) NULL,\n \"owner_institution_code\"\tvarchar(255) NULL,\n \"record_language\" \tvarchar(35) NULL,\n \"record_references\" \tvarchar(2048) NULL,\n \"record_type\" \tvarchar(32) NULL,\n \"rights_holder\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"image_set_upload_id\" \tbigint NULL,\n CONSTRAINT \"PK__darwin_c__3213E83F92DAE497\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"fathomnet_identities\" (\n \"id\" \tbigint NOT NULL,\n \"api_key\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"disabled\" \tbit NULL,\n \"display_name\" \tvarchar(255) NULL,\n \"email\" \tvarchar(255) NULL,\n \"expertise_rank\" \tvarchar(32) NULL,\n \"firebase_uid\" \tvarchar(255) NULL,\n \"job_title\" \tvarchar(255) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"organization\" \tvarchar(255) NULL,\n \"profile\" \tvarchar(1024) NULL,\n \"role_data\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"avatar_url\" \tvarchar(2000) NULL,\n \"orcid\" \tvarchar(32) NULL,\n \"notification_frequency\"\tvarchar(32) NULL,\n CONSTRAINT \"PK__fathomne__3213E83F59FE1468\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"fathomnet_identities_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"api_key\" \tvarchar(255) NULL,\n \"avatar_url\" \tvarchar(2000) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"disabled\" \tbit NULL,\n \"display_name\" \tvarchar(255) NULL,\n \"email\" \tvarchar(254) NULL,\n \"expertise_rank\" \tvarchar(32) NULL,\n \"firebase_uid\" \tvarchar(64) NULL,\n \"job_title\" \tvarchar(255) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"orcid\" \tvarchar(32) NULL,\n \"organization\" \tvarchar(255) NULL,\n \"profile\" \tvarchar(1024) NULL,\n \"role_data\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"notification_frequency\"\tvarchar(32) NULL,\n CONSTRAINT \"PK__fathomne__BE3894F9CD98EF78\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"followed_topics\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"email\" \tvarchar(254) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"notification\" \tbit NULL,\n \"target\" \tvarchar(256) NULL,\n \"topic\" \tvarchar(32) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n CONSTRAINT \"PK__followed__3213E83F4A1EA9E0\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"image_set_uploads\" (\n \"id\" \tbigint NOT NULL,\n \"contributors_email\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"format\" \tvarchar(255) NULL,\n \"last_updated_timestamp\" \tdatetime2(6) NULL,\n \"local_path\" \tvarchar(2048) NULL,\n \"rejection_details\" \tvarchar(255) NULL,\n \"rejection_reason\" \tvarchar(255) NULL,\n \"remote_uri\" \tvarchar(2048) NULL,\n \"sha256\" \tvarchar(64) NULL,\n \"status\" \tvarchar(255) NULL,\n \"status_update_timestamp\"\tdatetimeoffset(6) NULL,\n \"status_updater_email\" \tvarchar(254) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"darwincore_id\" \tbigint NULL,\n CONSTRAINT \"PK__image_se__3213E83F9C72A0E9\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"image_uploads_join\" (\n \"imagesetupload_id\"\tbigint NOT NULL,\n \"image_id\" \tbigint NOT NULL,\n CONSTRAINT \"PK__image_up__8A53EE0EBD9D776A\" PRIMARY KEY CLUSTERED(\"imagesetupload_id\",\"image_id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"images\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"depth_meters\" \tfloat NULL,\n \"height\" \tint NULL,\n \"imaging_type\" \tvarchar(64) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"last_validation\" \tdatetimeoffset(6) NULL,\n \"latitude\" \tfloat NULL,\n \"longitude\" \tfloat NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"modified\" \tdatetimeoffset(6) NULL,\n \"sha256\" \tvarchar(64) NULL,\n \"submitter\" \tvarchar(255) NULL,\n \"timestamp\" \tdatetimeoffset(6) NULL,\n \"url\" \tvarchar(2048) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"valid\" \tbit NULL,\n \"width\" \tint NULL,\n \"contributors_email\" \tvarchar(254) NULL,\n \"altitude\" \tfloat NULL,\n \"oxygen_ml_l\" \tfloat NULL,\n \"pressure_dbar\" \tfloat NULL,\n \"salinity\" \tfloat NULL,\n \"temperature_celsius\" \tfloat NULL,\n CONSTRAINT \"PK__images__3213E83FD76E309F\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"images_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"contributors_email\" \tvarchar(254) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"depth_meters\" \tfloat NULL,\n \"height\" \tint NULL,\n \"imaging_type\" \tvarchar(64) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"last_validation\" \tdatetimeoffset(6) NULL,\n \"latitude\" \tfloat NULL,\n \"longitude\" \tfloat NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"modified\" \tdatetimeoffset(6) NULL,\n \"sha256\" \tvarchar(64) NULL,\n \"timestamp\" \tdatetimeoffset(6) NULL,\n \"url\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"valid\" \tbit NULL,\n \"width\" \tint NULL,\n \"altitude\" \tfloat NULL,\n \"oxygen_ml_l\" \tfloat NULL,\n \"pressure_dbar\" \tfloat NULL,\n \"salinity\" \tfloat NULL,\n \"temperature_celsius\" \tfloat NULL,\n CONSTRAINT \"PK__images_a__BE3894F92DF6715C\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"marine_regions\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2 NULL,\n \"last_updated_timestamp\"\tdatetime2 NULL,\n \"max_latitude\" \tfloat NOT NULL,\n \"max_longitude\" \tfloat NOT NULL,\n \"min_latitude\" \tfloat NOT NULL,\n \"min_longitude\" \tfloat NOT NULL,\n \"mrgid\" \tbigint NULL,\n \"name\" \tvarchar(255) NULL,\n CONSTRAINT \"PK__marine_r__3213E83FE987FC8B\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"revinfo\" (\n \"rev\" \tint IDENTITY(1,1) NOT NULL,\n \"revtstmp\"\tbigint NULL,\n CONSTRAINT \"PK__revinfo__C2B7CC69D3938648\" PRIMARY KEY CLUSTERED(\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"tags\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2 NULL,\n \"tag\" \tvarchar(255) NOT NULL,\n \"last_updated_timestamp\"\tdatetime2 NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"value\" \tvarchar(255) NOT NULL,\n \"image_id\" \tbigint NULL,\n CONSTRAINT \"PK__tags__3213E83F3A490684\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"tags_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"created_timestamp\" \tdatetime2 NULL,\n \"tag\" \tvarchar(255) NULL,\n \"last_updated_timestamp\"\tdatetime2 NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"value\" \tvarchar(255) NULL,\n \"image_id\" \tbigint NULL,\n CONSTRAINT \"PK__tags_aud__BE3894F94F1608A8\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE VIEW \"dbo\".\"boundingbox_extended_info\" AS\n SELECT\n b.concept,\n b.alt_concept,\n b.observer,\n b.verified,\n b.verifier,\n b.verification_timestamp,\n b.user_defined_key,\n i.url,\n i.width,\n i.height,\n i.submitter,\n i.[timestamp],\n i.contributors_email AS image_contributors_email,\n u.contributors_email AS upload_contributors_email,\n dc.owner_institution_code,\n dc.institution_code,\n dc.rights_holder,\n dc.collection_code,\n dc.collection_id,\n dc.dataset_name\n FROM\n dbo.darwin_cores dc LEFT JOIN\n dbo.image_set_uploads u ON dc.id = u.darwincore_id LEFT JOIN\n dbo.image_uploads_join j ON j.imagesetupload_id = u.id LEFT JOIN\n dbo.images i ON j.image_id = i.id LEFT JOIN\n dbo.bounding_boxes b ON b.image_id = i.id\n ;\n\n First generate the observation from the prompt and how will you generate thq query, then only generate the prompt. Make sure the sql query is inside ```\n If the prompt is asking about species or images of individual species, draft the sql in such a way that it generates json array containing the species data. Species data must contain species concept and bounding box id as id.\n\n Prompt: Find me images of Aurelia aurita in Monterey Bay"}, {"role": "assistant", "content": "Observation:To find the images from the database so you need to format the output such that it is a json and has species array that has species concept as concept, image url as url, image id as image_id and species bounding box id as id\nThe prompt is asking image for a particular region, so its better to add the latitude and longitude information to the species data too. Since you need to find the images of Aurelia aurita in Monterey Bay, use the marine_regions table to lookup the Monterey Bay min/max latitude/longitude values to search for images.\nSince the prompt does not specify number of images. Limit the query to top 10 images\nSql Query:```SELECT i.urlSELECT TOP 10 i.url, i.id as image_id, b.concept, b.id, i.latitude, i.longitude\nFROM images i\nJOIN bounding_boxes b ON i.id = b.image_id\nJOIN marine_regions mr ON i.latitude BETWEEN mr.min_latitude AND mr.max_latitude AND\ni.longitude BETWEEN mr.min_longitude AND mr.max_longitude\nWHERE b.concept = 'Aurelia aurita'\n AND mr.name = 'Monterey Bay'\nFOR JSON PATH\nFROM images i\nJOIN bounding_boxes b ON i.id = b.image_id\nJOIN marine_regions mr ON i.latitude BETWEEN mr.min_latitude AND mr.max_latitude\nWHERE b.concept = 'Aurelia aurita'\n AND mr.name = 'Pacific Ocean'```"}]}
{"messages": [{"role": "system", "content": "You are a text-to-sql generator. You have a database of marine species. The sql should be generated in a way such that the response from sql is a json. "}, {"role": "user", "content": "\n The database has the following structure.\n\n CREATE TABLE \"dbo\".\"bounding_box_comments\" (\n \"id\" \tbigint NOT NULL,\n \"bounding_box_uuid\" \tuniqueidentifier NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"email\" \tvarchar(254) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"text\" \tvarchar(2048) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"alternate_concept\" \tvarchar(255) NULL,\n \"flagged\" \tbit NULL,\n CONSTRAINT \"PK__bounding__3213E83F71625CCD\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"bounding_boxes\" (\n \"id\" \tbigint NOT NULL,\n \"concept\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"group_of\" \tbit NULL,\n \"height\" \tint NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"observer\" \tvarchar(256) NULL,\n \"occluded\" \tbit NULL,\n \"truncated\" \tbit NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"verification_timestamp\"\tdatetimeoffset(6) NULL,\n \"verified\" \tbit NULL,\n \"verifier\" \tvarchar(256) NULL,\n \"width\" \tint NULL,\n \"x\" \tint NULL,\n \"y\" \tint NULL,\n \"image_id\" \tbigint NULL,\n \"alt_concept\" \tvarchar(255) NULL,\n \"user_defined_key\" \tvarchar(56) NULL,\n CONSTRAINT \"PK__bounding__3213E83F3E4C2D08\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"bounding_boxes_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"concept\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"group_of\" \tbit NULL,\n \"height\" \tint NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"observer\" \tvarchar(256) NULL,\n \"occluded\" \tbit NULL,\n \"truncated\" \tbit NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"verification_timestamp\"\tdatetimeoffset(6) NULL,\n \"verified\" \tbit NULL,\n \"verifier\" \tvarchar(256) NULL,\n \"width\" \tint NULL,\n \"x\" \tint NULL,\n \"y\" \tint NULL,\n \"image_id\" \tbigint NULL,\n \"alt_concept\" \tvarchar(255) NULL,\n \"user_defined_key\" \tvarchar(56) NULL,\n CONSTRAINT \"PK__bounding__BE3894F99D30F28A\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"darwin_cores\" (\n \"id\" \tbigint NOT NULL,\n \"access_rights\" \tvarchar(1024) NULL,\n \"basis_of_record\" \tvarchar(64) NULL,\n \"bibliographic_citation\"\tvarchar(512) NULL,\n \"collection_code\" \tvarchar(64) NULL,\n \"collection_id\" \tvarchar(2048) NULL,\n \"data_generalizations\" \tvarchar(512) NULL,\n \"dataset_id\" \tuniqueidentifier NULL,\n \"dataset_name\" \tvarchar(255) NULL,\n \"dynamic_properties\" \tvarchar(2048) NULL,\n \"information_withheld\" \tvarchar(255) NULL,\n \"institution_code\" \tvarchar(255) NULL,\n \"institution_id\" \tvarchar(255) NULL,\n \"license\" \tvarchar(2048) NULL,\n \"modified\" \tdatetimeoffset(6) NULL,\n \"owner_institution_code\"\tvarchar(255) NULL,\n \"record_language\" \tvarchar(35) NULL,\n \"record_references\" \tvarchar(2048) NULL,\n \"record_type\" \tvarchar(32) NULL,\n \"rights_holder\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"image_set_upload_id\" \tbigint NULL,\n CONSTRAINT \"PK__darwin_c__3213E83F92DAE497\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"fathomnet_identities\" (\n \"id\" \tbigint NOT NULL,\n \"api_key\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"disabled\" \tbit NULL,\n \"display_name\" \tvarchar(255) NULL,\n \"email\" \tvarchar(255) NULL,\n \"expertise_rank\" \tvarchar(32) NULL,\n \"firebase_uid\" \tvarchar(255) NULL,\n \"job_title\" \tvarchar(255) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"organization\" \tvarchar(255) NULL,\n \"profile\" \tvarchar(1024) NULL,\n \"role_data\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"avatar_url\" \tvarchar(2000) NULL,\n \"orcid\" \tvarchar(32) NULL,\n \"notification_frequency\"\tvarchar(32) NULL,\n CONSTRAINT \"PK__fathomne__3213E83F59FE1468\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"fathomnet_identities_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"api_key\" \tvarchar(255) NULL,\n \"avatar_url\" \tvarchar(2000) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"disabled\" \tbit NULL,\n \"display_name\" \tvarchar(255) NULL,\n \"email\" \tvarchar(254) NULL,\n \"expertise_rank\" \tvarchar(32) NULL,\n \"firebase_uid\" \tvarchar(64) NULL,\n \"job_title\" \tvarchar(255) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"orcid\" \tvarchar(32) NULL,\n \"organization\" \tvarchar(255) NULL,\n \"profile\" \tvarchar(1024) NULL,\n \"role_data\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"notification_frequency\"\tvarchar(32) NULL,\n CONSTRAINT \"PK__fathomne__BE3894F9CD98EF78\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"followed_topics\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"email\" \tvarchar(254) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"notification\" \tbit NULL,\n \"target\" \tvarchar(256) NULL,\n \"topic\" \tvarchar(32) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n CONSTRAINT \"PK__followed__3213E83F4A1EA9E0\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"image_set_uploads\" (\n \"id\" \tbigint NOT NULL,\n \"contributors_email\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"format\" \tvarchar(255) NULL,\n \"last_updated_timestamp\" \tdatetime2(6) NULL,\n \"local_path\" \tvarchar(2048) NULL,\n \"rejection_details\" \tvarchar(255) NULL,\n \"rejection_reason\" \tvarchar(255) NULL,\n \"remote_uri\" \tvarchar(2048) NULL,\n \"sha256\" \tvarchar(64) NULL,\n \"status\" \tvarchar(255) NULL,\n \"status_update_timestamp\"\tdatetimeoffset(6) NULL,\n \"status_updater_email\" \tvarchar(254) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"darwincore_id\" \tbigint NULL,\n CONSTRAINT \"PK__image_se__3213E83F9C72A0E9\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"image_uploads_join\" (\n \"imagesetupload_id\"\tbigint NOT NULL,\n \"image_id\" \tbigint NOT NULL,\n CONSTRAINT \"PK__image_up__8A53EE0EBD9D776A\" PRIMARY KEY CLUSTERED(\"imagesetupload_id\",\"image_id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"images\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"depth_meters\" \tfloat NULL,\n \"height\" \tint NULL,\n \"imaging_type\" \tvarchar(64) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"last_validation\" \tdatetimeoffset(6) NULL,\n \"latitude\" \tfloat NULL,\n \"longitude\" \tfloat NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"modified\" \tdatetimeoffset(6) NULL,\n \"sha256\" \tvarchar(64) NULL,\n \"submitter\" \tvarchar(255) NULL,\n \"timestamp\" \tdatetimeoffset(6) NULL,\n \"url\" \tvarchar(2048) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"valid\" \tbit NULL,\n \"width\" \tint NULL,\n \"contributors_email\" \tvarchar(254) NULL,\n \"altitude\" \tfloat NULL,\n \"oxygen_ml_l\" \tfloat NULL,\n \"pressure_dbar\" \tfloat NULL,\n \"salinity\" \tfloat NULL,\n \"temperature_celsius\" \tfloat NULL,\n CONSTRAINT \"PK__images__3213E83FD76E309F\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"images_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"contributors_email\" \tvarchar(254) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"depth_meters\" \tfloat NULL,\n \"height\" \tint NULL,\n \"imaging_type\" \tvarchar(64) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"last_validation\" \tdatetimeoffset(6) NULL,\n \"latitude\" \tfloat NULL,\n \"longitude\" \tfloat NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"modified\" \tdatetimeoffset(6) NULL,\n \"sha256\" \tvarchar(64) NULL,\n \"timestamp\" \tdatetimeoffset(6) NULL,\n \"url\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"valid\" \tbit NULL,\n \"width\" \tint NULL,\n \"altitude\" \tfloat NULL,\n \"oxygen_ml_l\" \tfloat NULL,\n \"pressure_dbar\" \tfloat NULL,\n \"salinity\" \tfloat NULL,\n \"temperature_celsius\" \tfloat NULL,\n CONSTRAINT \"PK__images_a__BE3894F92DF6715C\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"marine_regions\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2 NULL,\n \"last_updated_timestamp\"\tdatetime2 NULL,\n \"max_latitude\" \tfloat NOT NULL,\n \"max_longitude\" \tfloat NOT NULL,\n \"min_latitude\" \tfloat NOT NULL,\n \"min_longitude\" \tfloat NOT NULL,\n \"mrgid\" \tbigint NULL,\n \"name\" \tvarchar(255) NULL,\n CONSTRAINT \"PK__marine_r__3213E83FE987FC8B\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"revinfo\" (\n \"rev\" \tint IDENTITY(1,1) NOT NULL,\n \"revtstmp\"\tbigint NULL,\n CONSTRAINT \"PK__revinfo__C2B7CC69D3938648\" PRIMARY KEY CLUSTERED(\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"tags\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2 NULL,\n \"tag\" \tvarchar(255) NOT NULL,\n \"last_updated_timestamp\"\tdatetime2 NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"value\" \tvarchar(255) NOT NULL,\n \"image_id\" \tbigint NULL,\n CONSTRAINT \"PK__tags__3213E83F3A490684\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"tags_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"created_timestamp\" \tdatetime2 NULL,\n \"tag\" \tvarchar(255) NULL,\n \"last_updated_timestamp\"\tdatetime2 NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"value\" \tvarchar(255) NULL,\n \"image_id\" \tbigint NULL,\n CONSTRAINT \"PK__tags_aud__BE3894F94F1608A8\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE VIEW \"dbo\".\"boundingbox_extended_info\" AS\n SELECT\n b.concept,\n b.alt_concept,\n b.observer,\n b.verified,\n b.verifier,\n b.verification_timestamp,\n b.user_defined_key,\n i.url,\n i.width,\n i.height,\n i.submitter,\n i.[timestamp],\n i.contributors_email AS image_contributors_email,\n u.contributors_email AS upload_contributors_email,\n dc.owner_institution_code,\n dc.institution_code,\n dc.rights_holder,\n dc.collection_code,\n dc.collection_id,\n dc.dataset_name\n FROM\n dbo.darwin_cores dc LEFT JOIN\n dbo.image_set_uploads u ON dc.id = u.darwincore_id LEFT JOIN\n dbo.image_uploads_join j ON j.imagesetupload_id = u.id LEFT JOIN\n dbo.images i ON j.image_id = i.id LEFT JOIN\n dbo.bounding_boxes b ON b.image_id = i.id\n ;\n\n First generate the observation from the prompt and how will you generate thq query, then only generate the prompt. Make sure the sql query is inside ```\n If the prompt is asking about species or images of individual species, draft the sql in such a way that it generates json array containing the species data. Species data must contain species concept and bounding box id as id.\n\n Prompt: Find me images of species 'Aurelia aurita' in Monterey bay and depth less than 5k meters"}, {"role": "assistant", "content": "Observation:You need to find the images from the database so you need to format the output such that it is a json and has species array that has species concept as concept, image url as url, image id as image_id and species bounding box id as id\nThe prompt asks for species at depth less than 5k, so add the depth data too.\nUse the bounding_boxes, images and marine_regions table to find the species images\nSql Query:```SELECT TOP 10 i.url, i.id as image_id, b.concept, b.id, i.depth_meters\nFROM images i\nJOIN bounding_boxes b ON i.id = b.image_id\nJOIN marine_regions mr ON i.latitude BETWEEN mr.min_latitude AND mr.max_latitude\nWHERE b.concept = 'Aurelia aurita'\n AND mr.name = 'Monterey bay'\n AND i.depth_meters < 5000\nFOR JSON PATH```"}]}
{"messages": [{"role": "system", "content": "You are a text-to-sql generator. You have a database of marine species. The sql should be generated in a way such that the response from sql is a json. "}, {"role": "user", "content": "\n The database has the following structure.\n\n CREATE TABLE \"dbo\".\"bounding_box_comments\" (\n \"id\" \tbigint NOT NULL,\n \"bounding_box_uuid\" \tuniqueidentifier NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"email\" \tvarchar(254) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"text\" \tvarchar(2048) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"alternate_concept\" \tvarchar(255) NULL,\n \"flagged\" \tbit NULL,\n CONSTRAINT \"PK__bounding__3213E83F71625CCD\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"bounding_boxes\" (\n \"id\" \tbigint NOT NULL,\n \"concept\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"group_of\" \tbit NULL,\n \"height\" \tint NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"observer\" \tvarchar(256) NULL,\n \"occluded\" \tbit NULL,\n \"truncated\" \tbit NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"verification_timestamp\"\tdatetimeoffset(6) NULL,\n \"verified\" \tbit NULL,\n \"verifier\" \tvarchar(256) NULL,\n \"width\" \tint NULL,\n \"x\" \tint NULL,\n \"y\" \tint NULL,\n \"image_id\" \tbigint NULL,\n \"alt_concept\" \tvarchar(255) NULL,\n \"user_defined_key\" \tvarchar(56) NULL,\n CONSTRAINT \"PK__bounding__3213E83F3E4C2D08\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"bounding_boxes_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"concept\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"group_of\" \tbit NULL,\n \"height\" \tint NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"observer\" \tvarchar(256) NULL,\n \"occluded\" \tbit NULL,\n \"truncated\" \tbit NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"verification_timestamp\"\tdatetimeoffset(6) NULL,\n \"verified\" \tbit NULL,\n \"verifier\" \tvarchar(256) NULL,\n \"width\" \tint NULL,\n \"x\" \tint NULL,\n \"y\" \tint NULL,\n \"image_id\" \tbigint NULL,\n \"alt_concept\" \tvarchar(255) NULL,\n \"user_defined_key\" \tvarchar(56) NULL,\n CONSTRAINT \"PK__bounding__BE3894F99D30F28A\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"darwin_cores\" (\n \"id\" \tbigint NOT NULL,\n \"access_rights\" \tvarchar(1024) NULL,\n \"basis_of_record\" \tvarchar(64) NULL,\n \"bibliographic_citation\"\tvarchar(512) NULL,\n \"collection_code\" \tvarchar(64) NULL,\n \"collection_id\" \tvarchar(2048) NULL,\n \"data_generalizations\" \tvarchar(512) NULL,\n \"dataset_id\" \tuniqueidentifier NULL,\n \"dataset_name\" \tvarchar(255) NULL,\n \"dynamic_properties\" \tvarchar(2048) NULL,\n \"information_withheld\" \tvarchar(255) NULL,\n \"institution_code\" \tvarchar(255) NULL,\n \"institution_id\" \tvarchar(255) NULL,\n \"license\" \tvarchar(2048) NULL,\n \"modified\" \tdatetimeoffset(6) NULL,\n \"owner_institution_code\"\tvarchar(255) NULL,\n \"record_language\" \tvarchar(35) NULL,\n \"record_references\" \tvarchar(2048) NULL,\n \"record_type\" \tvarchar(32) NULL,\n \"rights_holder\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"image_set_upload_id\" \tbigint NULL,\n CONSTRAINT \"PK__darwin_c__3213E83F92DAE497\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"fathomnet_identities\" (\n \"id\" \tbigint NOT NULL,\n \"api_key\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"disabled\" \tbit NULL,\n \"display_name\" \tvarchar(255) NULL,\n \"email\" \tvarchar(255) NULL,\n \"expertise_rank\" \tvarchar(32) NULL,\n \"firebase_uid\" \tvarchar(255) NULL,\n \"job_title\" \tvarchar(255) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"organization\" \tvarchar(255) NULL,\n \"profile\" \tvarchar(1024) NULL,\n \"role_data\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"avatar_url\" \tvarchar(2000) NULL,\n \"orcid\" \tvarchar(32) NULL,\n \"notification_frequency\"\tvarchar(32) NULL,\n CONSTRAINT \"PK__fathomne__3213E83F59FE1468\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"fathomnet_identities_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"api_key\" \tvarchar(255) NULL,\n \"avatar_url\" \tvarchar(2000) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"disabled\" \tbit NULL,\n \"display_name\" \tvarchar(255) NULL,\n \"email\" \tvarchar(254) NULL,\n \"expertise_rank\" \tvarchar(32) NULL,\n \"firebase_uid\" \tvarchar(64) NULL,\n \"job_title\" \tvarchar(255) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"orcid\" \tvarchar(32) NULL,\n \"organization\" \tvarchar(255) NULL,\n \"profile\" \tvarchar(1024) NULL,\n \"role_data\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"notification_frequency\"\tvarchar(32) NULL,\n CONSTRAINT \"PK__fathomne__BE3894F9CD98EF78\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"followed_topics\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"email\" \tvarchar(254) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"notification\" \tbit NULL,\n \"target\" \tvarchar(256) NULL,\n \"topic\" \tvarchar(32) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n CONSTRAINT \"PK__followed__3213E83F4A1EA9E0\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"image_set_uploads\" (\n \"id\" \tbigint NOT NULL,\n \"contributors_email\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"format\" \tvarchar(255) NULL,\n \"last_updated_timestamp\" \tdatetime2(6) NULL,\n \"local_path\" \tvarchar(2048) NULL,\n \"rejection_details\" \tvarchar(255) NULL,\n \"rejection_reason\" \tvarchar(255) NULL,\n \"remote_uri\" \tvarchar(2048) NULL,\n \"sha256\" \tvarchar(64) NULL,\n \"status\" \tvarchar(255) NULL,\n \"status_update_timestamp\"\tdatetimeoffset(6) NULL,\n \"status_updater_email\" \tvarchar(254) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"darwincore_id\" \tbigint NULL,\n CONSTRAINT \"PK__image_se__3213E83F9C72A0E9\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"image_uploads_join\" (\n \"imagesetupload_id\"\tbigint NOT NULL,\n \"image_id\" \tbigint NOT NULL,\n CONSTRAINT \"PK__image_up__8A53EE0EBD9D776A\" PRIMARY KEY CLUSTERED(\"imagesetupload_id\",\"image_id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"images\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"depth_meters\" \tfloat NULL,\n \"height\" \tint NULL,\n \"imaging_type\" \tvarchar(64) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"last_validation\" \tdatetimeoffset(6) NULL,\n \"latitude\" \tfloat NULL,\n \"longitude\" \tfloat NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"modified\" \tdatetimeoffset(6) NULL,\n \"sha256\" \tvarchar(64) NULL,\n \"submitter\" \tvarchar(255) NULL,\n \"timestamp\" \tdatetimeoffset(6) NULL,\n \"url\" \tvarchar(2048) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"valid\" \tbit NULL,\n \"width\" \tint NULL,\n \"contributors_email\" \tvarchar(254) NULL,\n \"altitude\" \tfloat NULL,\n \"oxygen_ml_l\" \tfloat NULL,\n \"pressure_dbar\" \tfloat NULL,\n \"salinity\" \tfloat NULL,\n \"temperature_celsius\" \tfloat NULL,\n CONSTRAINT \"PK__images__3213E83FD76E309F\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"images_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"contributors_email\" \tvarchar(254) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"depth_meters\" \tfloat NULL,\n \"height\" \tint NULL,\n \"imaging_type\" \tvarchar(64) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"last_validation\" \tdatetimeoffset(6) NULL,\n \"latitude\" \tfloat NULL,\n \"longitude\" \tfloat NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"modified\" \tdatetimeoffset(6) NULL,\n \"sha256\" \tvarchar(64) NULL,\n \"timestamp\" \tdatetimeoffset(6) NULL,\n \"url\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"valid\" \tbit NULL,\n \"width\" \tint NULL,\n \"altitude\" \tfloat NULL,\n \"oxygen_ml_l\" \tfloat NULL,\n \"pressure_dbar\" \tfloat NULL,\n \"salinity\" \tfloat NULL,\n \"temperature_celsius\" \tfloat NULL,\n CONSTRAINT \"PK__images_a__BE3894F92DF6715C\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"marine_regions\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2 NULL,\n \"last_updated_timestamp\"\tdatetime2 NULL,\n \"max_latitude\" \tfloat NOT NULL,\n \"max_longitude\" \tfloat NOT NULL,\n \"min_latitude\" \tfloat NOT NULL,\n \"min_longitude\" \tfloat NOT NULL,\n \"mrgid\" \tbigint NULL,\n \"name\" \tvarchar(255) NULL,\n CONSTRAINT \"PK__marine_r__3213E83FE987FC8B\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"revinfo\" (\n \"rev\" \tint IDENTITY(1,1) NOT NULL,\n \"revtstmp\"\tbigint NULL,\n CONSTRAINT \"PK__revinfo__C2B7CC69D3938648\" PRIMARY KEY CLUSTERED(\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"tags\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2 NULL,\n \"tag\" \tvarchar(255) NOT NULL,\n \"last_updated_timestamp\"\tdatetime2 NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"value\" \tvarchar(255) NOT NULL,\n \"image_id\" \tbigint NULL,\n CONSTRAINT \"PK__tags__3213E83F3A490684\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"tags_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"created_timestamp\" \tdatetime2 NULL,\n \"tag\" \tvarchar(255) NULL,\n \"last_updated_timestamp\"\tdatetime2 NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"value\" \tvarchar(255) NULL,\n \"image_id\" \tbigint NULL,\n CONSTRAINT \"PK__tags_aud__BE3894F94F1608A8\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE VIEW \"dbo\".\"boundingbox_extended_info\" AS\n SELECT\n b.concept,\n b.alt_concept,\n b.observer,\n b.verified,\n b.verifier,\n b.verification_timestamp,\n b.user_defined_key,\n i.url,\n i.width,\n i.height,\n i.submitter,\n i.[timestamp],\n i.contributors_email AS image_contributors_email,\n u.contributors_email AS upload_contributors_email,\n dc.owner_institution_code,\n dc.institution_code,\n dc.rights_holder,\n dc.collection_code,\n dc.collection_id,\n dc.dataset_name\n FROM\n dbo.darwin_cores dc LEFT JOIN\n dbo.image_set_uploads u ON dc.id = u.darwincore_id LEFT JOIN\n dbo.image_uploads_join j ON j.imagesetupload_id = u.id LEFT JOIN\n dbo.images i ON j.image_id = i.id LEFT JOIN\n dbo.bounding_boxes b ON b.image_id = i.id\n ;\n\n First generate the observation from the prompt and how will you generate thq query, then only generate the prompt. Make sure the sql query is inside ```\n If the prompt is asking about species or images of individual species, draft the sql in such a way that it generates json array containing the species data. Species data must contain species concept and bounding box id as id.\n\n Prompt: Which location has the most Aurelia aurita"}, {"role": "assistant", "content": "Observation:The prompt asks for location that has the most Aurelia aurita. The prompt does not provide detail on what location would mean. So, use the marine_regions table and find the count of bounding boxes of Aurelia aurita in the regions, sort them from highest and smallest and output the top 15 results\n\nSql Query:```SELECT TOP 10 r.name, COUNT(b.id) AS count\nFROM dbo.bounding_boxes b\nJOIN dbo.images i ON b.image_id = i.id\nJOIN dbo.marine_regions r ON i.latitude BETWEEN r.min_latitude AND r.max_latitude\n AND i.longitude BETWEEN r.min_longitude AND r.max_longitude\nWHERE b.concept = 'Aurelia aurita'\nGROUP BY r.name\nORDER BY count DESC```"}]}
{"messages": [{"role": "system", "content": "You are a text-to-sql generator. You have a database of marine species. The sql should be generated in a way such that the response from sql is a json. "}, {"role": "user", "content": "\n The database has the following structure.\n\n CREATE TABLE \"dbo\".\"bounding_box_comments\" (\n \"id\" \tbigint NOT NULL,\n \"bounding_box_uuid\" \tuniqueidentifier NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"email\" \tvarchar(254) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"text\" \tvarchar(2048) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"alternate_concept\" \tvarchar(255) NULL,\n \"flagged\" \tbit NULL,\n CONSTRAINT \"PK__bounding__3213E83F71625CCD\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"bounding_boxes\" (\n \"id\" \tbigint NOT NULL,\n \"concept\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"group_of\" \tbit NULL,\n \"height\" \tint NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"observer\" \tvarchar(256) NULL,\n \"occluded\" \tbit NULL,\n \"truncated\" \tbit NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"verification_timestamp\"\tdatetimeoffset(6) NULL,\n \"verified\" \tbit NULL,\n \"verifier\" \tvarchar(256) NULL,\n \"width\" \tint NULL,\n \"x\" \tint NULL,\n \"y\" \tint NULL,\n \"image_id\" \tbigint NULL,\n \"alt_concept\" \tvarchar(255) NULL,\n \"user_defined_key\" \tvarchar(56) NULL,\n CONSTRAINT \"PK__bounding__3213E83F3E4C2D08\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"bounding_boxes_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"concept\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"group_of\" \tbit NULL,\n \"height\" \tint NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"observer\" \tvarchar(256) NULL,\n \"occluded\" \tbit NULL,\n \"truncated\" \tbit NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"verification_timestamp\"\tdatetimeoffset(6) NULL,\n \"verified\" \tbit NULL,\n \"verifier\" \tvarchar(256) NULL,\n \"width\" \tint NULL,\n \"x\" \tint NULL,\n \"y\" \tint NULL,\n \"image_id\" \tbigint NULL,\n \"alt_concept\" \tvarchar(255) NULL,\n \"user_defined_key\" \tvarchar(56) NULL,\n CONSTRAINT \"PK__bounding__BE3894F99D30F28A\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"darwin_cores\" (\n \"id\" \tbigint NOT NULL,\n \"access_rights\" \tvarchar(1024) NULL,\n \"basis_of_record\" \tvarchar(64) NULL,\n \"bibliographic_citation\"\tvarchar(512) NULL,\n \"collection_code\" \tvarchar(64) NULL,\n \"collection_id\" \tvarchar(2048) NULL,\n \"data_generalizations\" \tvarchar(512) NULL,\n \"dataset_id\" \tuniqueidentifier NULL,\n \"dataset_name\" \tvarchar(255) NULL,\n \"dynamic_properties\" \tvarchar(2048) NULL,\n \"information_withheld\" \tvarchar(255) NULL,\n \"institution_code\" \tvarchar(255) NULL,\n \"institution_id\" \tvarchar(255) NULL,\n \"license\" \tvarchar(2048) NULL,\n \"modified\" \tdatetimeoffset(6) NULL,\n \"owner_institution_code\"\tvarchar(255) NULL,\n \"record_language\" \tvarchar(35) NULL,\n \"record_references\" \tvarchar(2048) NULL,\n \"record_type\" \tvarchar(32) NULL,\n \"rights_holder\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"image_set_upload_id\" \tbigint NULL,\n CONSTRAINT \"PK__darwin_c__3213E83F92DAE497\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"fathomnet_identities\" (\n \"id\" \tbigint NOT NULL,\n \"api_key\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"disabled\" \tbit NULL,\n \"display_name\" \tvarchar(255) NULL,\n \"email\" \tvarchar(255) NULL,\n \"expertise_rank\" \tvarchar(32) NULL,\n \"firebase_uid\" \tvarchar(255) NULL,\n \"job_title\" \tvarchar(255) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"organization\" \tvarchar(255) NULL,\n \"profile\" \tvarchar(1024) NULL,\n \"role_data\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"avatar_url\" \tvarchar(2000) NULL,\n \"orcid\" \tvarchar(32) NULL,\n \"notification_frequency\"\tvarchar(32) NULL,\n CONSTRAINT \"PK__fathomne__3213E83F59FE1468\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"fathomnet_identities_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"api_key\" \tvarchar(255) NULL,\n \"avatar_url\" \tvarchar(2000) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"disabled\" \tbit NULL,\n \"display_name\" \tvarchar(255) NULL,\n \"email\" \tvarchar(254) NULL,\n \"expertise_rank\" \tvarchar(32) NULL,\n \"firebase_uid\" \tvarchar(64) NULL,\n \"job_title\" \tvarchar(255) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"orcid\" \tvarchar(32) NULL,\n \"organization\" \tvarchar(255) NULL,\n \"profile\" \tvarchar(1024) NULL,\n \"role_data\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"notification_frequency\"\tvarchar(32) NULL,\n CONSTRAINT \"PK__fathomne__BE3894F9CD98EF78\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"followed_topics\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"email\" \tvarchar(254) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"notification\" \tbit NULL,\n \"target\" \tvarchar(256) NULL,\n \"topic\" \tvarchar(32) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n CONSTRAINT \"PK__followed__3213E83F4A1EA9E0\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"image_set_uploads\" (\n \"id\" \tbigint NOT NULL,\n \"contributors_email\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"format\" \tvarchar(255) NULL,\n \"last_updated_timestamp\" \tdatetime2(6) NULL,\n \"local_path\" \tvarchar(2048) NULL,\n \"rejection_details\" \tvarchar(255) NULL,\n \"rejection_reason\" \tvarchar(255) NULL,\n \"remote_uri\" \tvarchar(2048) NULL,\n \"sha256\" \tvarchar(64) NULL,\n \"status\" \tvarchar(255) NULL,\n \"status_update_timestamp\"\tdatetimeoffset(6) NULL,\n \"status_updater_email\" \tvarchar(254) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"darwincore_id\" \tbigint NULL,\n CONSTRAINT \"PK__image_se__3213E83F9C72A0E9\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"image_uploads_join\" (\n \"imagesetupload_id\"\tbigint NOT NULL,\n \"image_id\" \tbigint NOT NULL,\n CONSTRAINT \"PK__image_up__8A53EE0EBD9D776A\" PRIMARY KEY CLUSTERED(\"imagesetupload_id\",\"image_id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"images\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"depth_meters\" \tfloat NULL,\n \"height\" \tint NULL,\n \"imaging_type\" \tvarchar(64) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"last_validation\" \tdatetimeoffset(6) NULL,\n \"latitude\" \tfloat NULL,\n \"longitude\" \tfloat NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"modified\" \tdatetimeoffset(6) NULL,\n \"sha256\" \tvarchar(64) NULL,\n \"submitter\" \tvarchar(255) NULL,\n \"timestamp\" \tdatetimeoffset(6) NULL,\n \"url\" \tvarchar(2048) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"valid\" \tbit NULL,\n \"width\" \tint NULL,\n \"contributors_email\" \tvarchar(254) NULL,\n \"altitude\" \tfloat NULL,\n \"oxygen_ml_l\" \tfloat NULL,\n \"pressure_dbar\" \tfloat NULL,\n \"salinity\" \tfloat NULL,\n \"temperature_celsius\" \tfloat NULL,\n CONSTRAINT \"PK__images__3213E83FD76E309F\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"images_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"contributors_email\" \tvarchar(254) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"depth_meters\" \tfloat NULL,\n \"height\" \tint NULL,\n \"imaging_type\" \tvarchar(64) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"last_validation\" \tdatetimeoffset(6) NULL,\n \"latitude\" \tfloat NULL,\n \"longitude\" \tfloat NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"modified\" \tdatetimeoffset(6) NULL,\n \"sha256\" \tvarchar(64) NULL,\n \"timestamp\" \tdatetimeoffset(6) NULL,\n \"url\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"valid\" \tbit NULL,\n \"width\" \tint NULL,\n \"altitude\" \tfloat NULL,\n \"oxygen_ml_l\" \tfloat NULL,\n \"pressure_dbar\" \tfloat NULL,\n \"salinity\" \tfloat NULL,\n \"temperature_celsius\" \tfloat NULL,\n CONSTRAINT \"PK__images_a__BE3894F92DF6715C\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"marine_regions\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2 NULL,\n \"last_updated_timestamp\"\tdatetime2 NULL,\n \"max_latitude\" \tfloat NOT NULL,\n \"max_longitude\" \tfloat NOT NULL,\n \"min_latitude\" \tfloat NOT NULL,\n \"min_longitude\" \tfloat NOT NULL,\n \"mrgid\" \tbigint NULL,\n \"name\" \tvarchar(255) NULL,\n CONSTRAINT \"PK__marine_r__3213E83FE987FC8B\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"revinfo\" (\n \"rev\" \tint IDENTITY(1,1) NOT NULL,\n \"revtstmp\"\tbigint NULL,\n CONSTRAINT \"PK__revinfo__C2B7CC69D3938648\" PRIMARY KEY CLUSTERED(\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"tags\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2 NULL,\n \"tag\" \tvarchar(255) NOT NULL,\n \"last_updated_timestamp\"\tdatetime2 NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"value\" \tvarchar(255) NOT NULL,\n \"image_id\" \tbigint NULL,\n CONSTRAINT \"PK__tags__3213E83F3A490684\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"tags_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"created_timestamp\" \tdatetime2 NULL,\n \"tag\" \tvarchar(255) NULL,\n \"last_updated_timestamp\"\tdatetime2 NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"value\" \tvarchar(255) NULL,\n \"image_id\" \tbigint NULL,\n CONSTRAINT \"PK__tags_aud__BE3894F94F1608A8\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE VIEW \"dbo\".\"boundingbox_extended_info\" AS\n SELECT\n b.concept,\n b.alt_concept,\n b.observer,\n b.verified,\n b.verifier,\n b.verification_timestamp,\n b.user_defined_key,\n i.url,\n i.width,\n i.height,\n i.submitter,\n i.[timestamp],\n i.contributors_email AS image_contributors_email,\n u.contributors_email AS upload_contributors_email,\n dc.owner_institution_code,\n dc.institution_code,\n dc.rights_holder,\n dc.collection_code,\n dc.collection_id,\n dc.dataset_name\n FROM\n dbo.darwin_cores dc LEFT JOIN\n dbo.image_set_uploads u ON dc.id = u.darwincore_id LEFT JOIN\n dbo.image_uploads_join j ON j.imagesetupload_id = u.id LEFT JOIN\n dbo.images i ON j.image_id = i.id LEFT JOIN\n dbo.bounding_boxes b ON b.image_id = i.id\n ;\n\n First generate the observation from the prompt and how will you generate thq query, then only generate the prompt. Make sure the sql query is inside ```\n If the prompt is asking about species or images of individual species, draft the sql in such a way that it generates json array containing the species data. Species data must contain species concept and bounding box id as id.\n\n Prompt: What species are frequently found near Aurelia aurita?"}, {"role": "assistant", "content": "Observation:The prompt asks for frequently found species near Aurelia aurita without providing detail what frequent means numerically. So, find the number of images that have Aurelia aurita and another species. Use the bounding_boxes table to find another species that is near Aurelia aurita and output the name and the frequency\n\nSql Query:```SELECT b2.concept AS species, COUNT(*) AS frequency\nFROM dbo.bounding_boxes b1\nJOIN dbo.bounding_boxes b2 ON b1.image_id = b2.image_id\nWHERE b1.concept = 'Aurelia aurita' AND b2.concept <> 'Aurelia aurita'\nGROUP BY b2.concept\nORDER BY frequency DESC;```"}]}
{"messages": [{"role": "system", "content": "You are a text-to-sql generator. You have a database of marine species. The sql should be generated in a way such that the response from sql is a json. "}, {"role": "user", "content": "\n The database has the following structure.\n\n CREATE TABLE \"dbo\".\"bounding_box_comments\" (\n \"id\" \tbigint NOT NULL,\n \"bounding_box_uuid\" \tuniqueidentifier NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"email\" \tvarchar(254) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"text\" \tvarchar(2048) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"alternate_concept\" \tvarchar(255) NULL,\n \"flagged\" \tbit NULL,\n CONSTRAINT \"PK__bounding__3213E83F71625CCD\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"bounding_boxes\" (\n \"id\" \tbigint NOT NULL,\n \"concept\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"group_of\" \tbit NULL,\n \"height\" \tint NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"observer\" \tvarchar(256) NULL,\n \"occluded\" \tbit NULL,\n \"truncated\" \tbit NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"verification_timestamp\"\tdatetimeoffset(6) NULL,\n \"verified\" \tbit NULL,\n \"verifier\" \tvarchar(256) NULL,\n \"width\" \tint NULL,\n \"x\" \tint NULL,\n \"y\" \tint NULL,\n \"image_id\" \tbigint NULL,\n \"alt_concept\" \tvarchar(255) NULL,\n \"user_defined_key\" \tvarchar(56) NULL,\n CONSTRAINT \"PK__bounding__3213E83F3E4C2D08\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"bounding_boxes_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"concept\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"group_of\" \tbit NULL,\n \"height\" \tint NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"observer\" \tvarchar(256) NULL,\n \"occluded\" \tbit NULL,\n \"truncated\" \tbit NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"verification_timestamp\"\tdatetimeoffset(6) NULL,\n \"verified\" \tbit NULL,\n \"verifier\" \tvarchar(256) NULL,\n \"width\" \tint NULL,\n \"x\" \tint NULL,\n \"y\" \tint NULL,\n \"image_id\" \tbigint NULL,\n \"alt_concept\" \tvarchar(255) NULL,\n \"user_defined_key\" \tvarchar(56) NULL,\n CONSTRAINT \"PK__bounding__BE3894F99D30F28A\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"darwin_cores\" (\n \"id\" \tbigint NOT NULL,\n \"access_rights\" \tvarchar(1024) NULL,\n \"basis_of_record\" \tvarchar(64) NULL,\n \"bibliographic_citation\"\tvarchar(512) NULL,\n \"collection_code\" \tvarchar(64) NULL,\n \"collection_id\" \tvarchar(2048) NULL,\n \"data_generalizations\" \tvarchar(512) NULL,\n \"dataset_id\" \tuniqueidentifier NULL,\n \"dataset_name\" \tvarchar(255) NULL,\n \"dynamic_properties\" \tvarchar(2048) NULL,\n \"information_withheld\" \tvarchar(255) NULL,\n \"institution_code\" \tvarchar(255) NULL,\n \"institution_id\" \tvarchar(255) NULL,\n \"license\" \tvarchar(2048) NULL,\n \"modified\" \tdatetimeoffset(6) NULL,\n \"owner_institution_code\"\tvarchar(255) NULL,\n \"record_language\" \tvarchar(35) NULL,\n \"record_references\" \tvarchar(2048) NULL,\n \"record_type\" \tvarchar(32) NULL,\n \"rights_holder\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"image_set_upload_id\" \tbigint NULL,\n CONSTRAINT \"PK__darwin_c__3213E83F92DAE497\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"fathomnet_identities\" (\n \"id\" \tbigint NOT NULL,\n \"api_key\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"disabled\" \tbit NULL,\n \"display_name\" \tvarchar(255) NULL,\n \"email\" \tvarchar(255) NULL,\n \"expertise_rank\" \tvarchar(32) NULL,\n \"firebase_uid\" \tvarchar(255) NULL,\n \"job_title\" \tvarchar(255) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"organization\" \tvarchar(255) NULL,\n \"profile\" \tvarchar(1024) NULL,\n \"role_data\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"avatar_url\" \tvarchar(2000) NULL,\n \"orcid\" \tvarchar(32) NULL,\n \"notification_frequency\"\tvarchar(32) NULL,\n CONSTRAINT \"PK__fathomne__3213E83F59FE1468\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"fathomnet_identities_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"api_key\" \tvarchar(255) NULL,\n \"avatar_url\" \tvarchar(2000) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"disabled\" \tbit NULL,\n \"display_name\" \tvarchar(255) NULL,\n \"email\" \tvarchar(254) NULL,\n \"expertise_rank\" \tvarchar(32) NULL,\n \"firebase_uid\" \tvarchar(64) NULL,\n \"job_title\" \tvarchar(255) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"orcid\" \tvarchar(32) NULL,\n \"organization\" \tvarchar(255) NULL,\n \"profile\" \tvarchar(1024) NULL,\n \"role_data\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"notification_frequency\"\tvarchar(32) NULL,\n CONSTRAINT \"PK__fathomne__BE3894F9CD98EF78\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"followed_topics\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"email\" \tvarchar(254) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"notification\" \tbit NULL,\n \"target\" \tvarchar(256) NULL,\n \"topic\" \tvarchar(32) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n CONSTRAINT \"PK__followed__3213E83F4A1EA9E0\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"image_set_uploads\" (\n \"id\" \tbigint NOT NULL,\n \"contributors_email\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"format\" \tvarchar(255) NULL,\n \"last_updated_timestamp\" \tdatetime2(6) NULL,\n \"local_path\" \tvarchar(2048) NULL,\n \"rejection_details\" \tvarchar(255) NULL,\n \"rejection_reason\" \tvarchar(255) NULL,\n \"remote_uri\" \tvarchar(2048) NULL,\n \"sha256\" \tvarchar(64) NULL,\n \"status\" \tvarchar(255) NULL,\n \"status_update_timestamp\"\tdatetimeoffset(6) NULL,\n \"status_updater_email\" \tvarchar(254) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"darwincore_id\" \tbigint NULL,\n CONSTRAINT \"PK__image_se__3213E83F9C72A0E9\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"image_uploads_join\" (\n \"imagesetupload_id\"\tbigint NOT NULL,\n \"image_id\" \tbigint NOT NULL,\n CONSTRAINT \"PK__image_up__8A53EE0EBD9D776A\" PRIMARY KEY CLUSTERED(\"imagesetupload_id\",\"image_id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"images\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"depth_meters\" \tfloat NULL,\n \"height\" \tint NULL,\n \"imaging_type\" \tvarchar(64) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"last_validation\" \tdatetimeoffset(6) NULL,\n \"latitude\" \tfloat NULL,\n \"longitude\" \tfloat NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"modified\" \tdatetimeoffset(6) NULL,\n \"sha256\" \tvarchar(64) NULL,\n \"submitter\" \tvarchar(255) NULL,\n \"timestamp\" \tdatetimeoffset(6) NULL,\n \"url\" \tvarchar(2048) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"valid\" \tbit NULL,\n \"width\" \tint NULL,\n \"contributors_email\" \tvarchar(254) NULL,\n \"altitude\" \tfloat NULL,\n \"oxygen_ml_l\" \tfloat NULL,\n \"pressure_dbar\" \tfloat NULL,\n \"salinity\" \tfloat NULL,\n \"temperature_celsius\" \tfloat NULL,\n CONSTRAINT \"PK__images__3213E83FD76E309F\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"images_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"contributors_email\" \tvarchar(254) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"depth_meters\" \tfloat NULL,\n \"height\" \tint NULL,\n \"imaging_type\" \tvarchar(64) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"last_validation\" \tdatetimeoffset(6) NULL,\n \"latitude\" \tfloat NULL,\n \"longitude\" \tfloat NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"modified\" \tdatetimeoffset(6) NULL,\n \"sha256\" \tvarchar(64) NULL,\n \"timestamp\" \tdatetimeoffset(6) NULL,\n \"url\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"valid\" \tbit NULL,\n \"width\" \tint NULL,\n \"altitude\" \tfloat NULL,\n \"oxygen_ml_l\" \tfloat NULL,\n \"pressure_dbar\" \tfloat NULL,\n \"salinity\" \tfloat NULL,\n \"temperature_celsius\" \tfloat NULL,\n CONSTRAINT \"PK__images_a__BE3894F92DF6715C\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"marine_regions\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2 NULL,\n \"last_updated_timestamp\"\tdatetime2 NULL,\n \"max_latitude\" \tfloat NOT NULL,\n \"max_longitude\" \tfloat NOT NULL,\n \"min_latitude\" \tfloat NOT NULL,\n \"min_longitude\" \tfloat NOT NULL,\n \"mrgid\" \tbigint NULL,\n \"name\" \tvarchar(255) NULL,\n CONSTRAINT \"PK__marine_r__3213E83FE987FC8B\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"revinfo\" (\n \"rev\" \tint IDENTITY(1,1) NOT NULL,\n \"revtstmp\"\tbigint NULL,\n CONSTRAINT \"PK__revinfo__C2B7CC69D3938648\" PRIMARY KEY CLUSTERED(\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"tags\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2 NULL,\n \"tag\" \tvarchar(255) NOT NULL,\n \"last_updated_timestamp\"\tdatetime2 NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"value\" \tvarchar(255) NOT NULL,\n \"image_id\" \tbigint NULL,\n CONSTRAINT \"PK__tags__3213E83F3A490684\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"tags_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"created_timestamp\" \tdatetime2 NULL,\n \"tag\" \tvarchar(255) NULL,\n \"last_updated_timestamp\"\tdatetime2 NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"value\" \tvarchar(255) NULL,\n \"image_id\" \tbigint NULL,\n CONSTRAINT \"PK__tags_aud__BE3894F94F1608A8\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE VIEW \"dbo\".\"boundingbox_extended_info\" AS\n SELECT\n b.concept,\n b.alt_concept,\n b.observer,\n b.verified,\n b.verifier,\n b.verification_timestamp,\n b.user_defined_key,\n i.url,\n i.width,\n i.height,\n i.submitter,\n i.[timestamp],\n i.contributors_email AS image_contributors_email,\n u.contributors_email AS upload_contributors_email,\n dc.owner_institution_code,\n dc.institution_code,\n dc.rights_holder,\n dc.collection_code,\n dc.collection_id,\n dc.dataset_name\n FROM\n dbo.darwin_cores dc LEFT JOIN\n dbo.image_set_uploads u ON dc.id = u.darwincore_id LEFT JOIN\n dbo.image_uploads_join j ON j.imagesetupload_id = u.id LEFT JOIN\n dbo.images i ON j.image_id = i.id LEFT JOIN\n dbo.bounding_boxes b ON b.image_id = i.id\n ;\n\n First generate the observation from the prompt and how will you generate thq query, then only generate the prompt. Make sure the sql query is inside ```\n If the prompt is asking about species or images of individual species, draft the sql in such a way that it generates json array containing the species data. Species data must contain species concept and bounding box id as id.\n\n Prompt: How often are Aurelia aurita found near other species?"}, {"role": "assistant", "content": "Observation:The prompt does not provide what often would mean numerically, so first find all distinct images in the database that has Aurelia aurita. Now, find the images that have Aurelia aurita and another species. Now output the total AureliaImages and images that have other species\n\nSql Query:```WITH AureliaImages AS (\n SELECT DISTINCT image_id\n FROM dbo.bounding_boxes\n WHERE concept = 'Aurelia aurita'\n),\nOtherSpeciesInAureliaImages AS (\n SELECT DISTINCT bb1.image_id\n FROM dbo.bounding_boxes AS bb1\n JOIN dbo.bounding_boxes AS bb2 ON bb1.image_id = bb2.image_id\n WHERE bb1.concept = 'Aurelia aurita' AND bb2.concept != 'Aurelia aurita'\n)\nSELECT \n COUNT(*) AS 'Frequency',\n (SELECT COUNT(*) FROM AureliaImages) AS 'TotalAureliaImages'\nFROM OtherSpeciesInAureliaImages;```"}]}
{"messages": [{"role": "system", "content": "You are a text-to-sql generator. You have a database of marine species. The sql should be generated in a way such that the response from sql is a json. "}, {"role": "user", "content": "\n The database has the following structure.\n\n CREATE TABLE \"dbo\".\"bounding_box_comments\" (\n \"id\" \tbigint NOT NULL,\n \"bounding_box_uuid\" \tuniqueidentifier NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"email\" \tvarchar(254) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"text\" \tvarchar(2048) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"alternate_concept\" \tvarchar(255) NULL,\n \"flagged\" \tbit NULL,\n CONSTRAINT \"PK__bounding__3213E83F71625CCD\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"bounding_boxes\" (\n \"id\" \tbigint NOT NULL,\n \"concept\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"group_of\" \tbit NULL,\n \"height\" \tint NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"observer\" \tvarchar(256) NULL,\n \"occluded\" \tbit NULL,\n \"truncated\" \tbit NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"verification_timestamp\"\tdatetimeoffset(6) NULL,\n \"verified\" \tbit NULL,\n \"verifier\" \tvarchar(256) NULL,\n \"width\" \tint NULL,\n \"x\" \tint NULL,\n \"y\" \tint NULL,\n \"image_id\" \tbigint NULL,\n \"alt_concept\" \tvarchar(255) NULL,\n \"user_defined_key\" \tvarchar(56) NULL,\n CONSTRAINT \"PK__bounding__3213E83F3E4C2D08\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"bounding_boxes_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"concept\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"group_of\" \tbit NULL,\n \"height\" \tint NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"observer\" \tvarchar(256) NULL,\n \"occluded\" \tbit NULL,\n \"truncated\" \tbit NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"verification_timestamp\"\tdatetimeoffset(6) NULL,\n \"verified\" \tbit NULL,\n \"verifier\" \tvarchar(256) NULL,\n \"width\" \tint NULL,\n \"x\" \tint NULL,\n \"y\" \tint NULL,\n \"image_id\" \tbigint NULL,\n \"alt_concept\" \tvarchar(255) NULL,\n \"user_defined_key\" \tvarchar(56) NULL,\n CONSTRAINT \"PK__bounding__BE3894F99D30F28A\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"darwin_cores\" (\n \"id\" \tbigint NOT NULL,\n \"access_rights\" \tvarchar(1024) NULL,\n \"basis_of_record\" \tvarchar(64) NULL,\n \"bibliographic_citation\"\tvarchar(512) NULL,\n \"collection_code\" \tvarchar(64) NULL,\n \"collection_id\" \tvarchar(2048) NULL,\n \"data_generalizations\" \tvarchar(512) NULL,\n \"dataset_id\" \tuniqueidentifier NULL,\n \"dataset_name\" \tvarchar(255) NULL,\n \"dynamic_properties\" \tvarchar(2048) NULL,\n \"information_withheld\" \tvarchar(255) NULL,\n \"institution_code\" \tvarchar(255) NULL,\n \"institution_id\" \tvarchar(255) NULL,\n \"license\" \tvarchar(2048) NULL,\n \"modified\" \tdatetimeoffset(6) NULL,\n \"owner_institution_code\"\tvarchar(255) NULL,\n \"record_language\" \tvarchar(35) NULL,\n \"record_references\" \tvarchar(2048) NULL,\n \"record_type\" \tvarchar(32) NULL,\n \"rights_holder\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"image_set_upload_id\" \tbigint NULL,\n CONSTRAINT \"PK__darwin_c__3213E83F92DAE497\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"fathomnet_identities\" (\n \"id\" \tbigint NOT NULL,\n \"api_key\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"disabled\" \tbit NULL,\n \"display_name\" \tvarchar(255) NULL,\n \"email\" \tvarchar(255) NULL,\n \"expertise_rank\" \tvarchar(32) NULL,\n \"firebase_uid\" \tvarchar(255) NULL,\n \"job_title\" \tvarchar(255) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"organization\" \tvarchar(255) NULL,\n \"profile\" \tvarchar(1024) NULL,\n \"role_data\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"avatar_url\" \tvarchar(2000) NULL,\n \"orcid\" \tvarchar(32) NULL,\n \"notification_frequency\"\tvarchar(32) NULL,\n CONSTRAINT \"PK__fathomne__3213E83F59FE1468\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"fathomnet_identities_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"api_key\" \tvarchar(255) NULL,\n \"avatar_url\" \tvarchar(2000) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"disabled\" \tbit NULL,\n \"display_name\" \tvarchar(255) NULL,\n \"email\" \tvarchar(254) NULL,\n \"expertise_rank\" \tvarchar(32) NULL,\n \"firebase_uid\" \tvarchar(64) NULL,\n \"job_title\" \tvarchar(255) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"orcid\" \tvarchar(32) NULL,\n \"organization\" \tvarchar(255) NULL,\n \"profile\" \tvarchar(1024) NULL,\n \"role_data\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"notification_frequency\"\tvarchar(32) NULL,\n CONSTRAINT \"PK__fathomne__BE3894F9CD98EF78\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"followed_topics\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"email\" \tvarchar(254) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"notification\" \tbit NULL,\n \"target\" \tvarchar(256) NULL,\n \"topic\" \tvarchar(32) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n CONSTRAINT \"PK__followed__3213E83F4A1EA9E0\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"image_set_uploads\" (\n \"id\" \tbigint NOT NULL,\n \"contributors_email\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"format\" \tvarchar(255) NULL,\n \"last_updated_timestamp\" \tdatetime2(6) NULL,\n \"local_path\" \tvarchar(2048) NULL,\n \"rejection_details\" \tvarchar(255) NULL,\n \"rejection_reason\" \tvarchar(255) NULL,\n \"remote_uri\" \tvarchar(2048) NULL,\n \"sha256\" \tvarchar(64) NULL,\n \"status\" \tvarchar(255) NULL,\n \"status_update_timestamp\"\tdatetimeoffset(6) NULL,\n \"status_updater_email\" \tvarchar(254) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"darwincore_id\" \tbigint NULL,\n CONSTRAINT \"PK__image_se__3213E83F9C72A0E9\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"image_uploads_join\" (\n \"imagesetupload_id\"\tbigint NOT NULL,\n \"image_id\" \tbigint NOT NULL,\n CONSTRAINT \"PK__image_up__8A53EE0EBD9D776A\" PRIMARY KEY CLUSTERED(\"imagesetupload_id\",\"image_id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"images\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"depth_meters\" \tfloat NULL,\n \"height\" \tint NULL,\n \"imaging_type\" \tvarchar(64) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"last_validation\" \tdatetimeoffset(6) NULL,\n \"latitude\" \tfloat NULL,\n \"longitude\" \tfloat NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"modified\" \tdatetimeoffset(6) NULL,\n \"sha256\" \tvarchar(64) NULL,\n \"submitter\" \tvarchar(255) NULL,\n \"timestamp\" \tdatetimeoffset(6) NULL,\n \"url\" \tvarchar(2048) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"valid\" \tbit NULL,\n \"width\" \tint NULL,\n \"contributors_email\" \tvarchar(254) NULL,\n \"altitude\" \tfloat NULL,\n \"oxygen_ml_l\" \tfloat NULL,\n \"pressure_dbar\" \tfloat NULL,\n \"salinity\" \tfloat NULL,\n \"temperature_celsius\" \tfloat NULL,\n CONSTRAINT \"PK__images__3213E83FD76E309F\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"images_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"contributors_email\" \tvarchar(254) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"depth_meters\" \tfloat NULL,\n \"height\" \tint NULL,\n \"imaging_type\" \tvarchar(64) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"last_validation\" \tdatetimeoffset(6) NULL,\n \"latitude\" \tfloat NULL,\n \"longitude\" \tfloat NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"modified\" \tdatetimeoffset(6) NULL,\n \"sha256\" \tvarchar(64) NULL,\n \"timestamp\" \tdatetimeoffset(6) NULL,\n \"url\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"valid\" \tbit NULL,\n \"width\" \tint NULL,\n \"altitude\" \tfloat NULL,\n \"oxygen_ml_l\" \tfloat NULL,\n \"pressure_dbar\" \tfloat NULL,\n \"salinity\" \tfloat NULL,\n \"temperature_celsius\" \tfloat NULL,\n CONSTRAINT \"PK__images_a__BE3894F92DF6715C\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"marine_regions\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2 NULL,\n \"last_updated_timestamp\"\tdatetime2 NULL,\n \"max_latitude\" \tfloat NOT NULL,\n \"max_longitude\" \tfloat NOT NULL,\n \"min_latitude\" \tfloat NOT NULL,\n \"min_longitude\" \tfloat NOT NULL,\n \"mrgid\" \tbigint NULL,\n \"name\" \tvarchar(255) NULL,\n CONSTRAINT \"PK__marine_r__3213E83FE987FC8B\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"revinfo\" (\n \"rev\" \tint IDENTITY(1,1) NOT NULL,\n \"revtstmp\"\tbigint NULL,\n CONSTRAINT \"PK__revinfo__C2B7CC69D3938648\" PRIMARY KEY CLUSTERED(\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"tags\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2 NULL,\n \"tag\" \tvarchar(255) NOT NULL,\n \"last_updated_timestamp\"\tdatetime2 NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"value\" \tvarchar(255) NOT NULL,\n \"image_id\" \tbigint NULL,\n CONSTRAINT \"PK__tags__3213E83F3A490684\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"tags_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"created_timestamp\" \tdatetime2 NULL,\n \"tag\" \tvarchar(255) NULL,\n \"last_updated_timestamp\"\tdatetime2 NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"value\" \tvarchar(255) NULL,\n \"image_id\" \tbigint NULL,\n CONSTRAINT \"PK__tags_aud__BE3894F94F1608A8\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE VIEW \"dbo\".\"boundingbox_extended_info\" AS\n SELECT\n b.concept,\n b.alt_concept,\n b.observer,\n b.verified,\n b.verifier,\n b.verification_timestamp,\n b.user_defined_key,\n i.url,\n i.width,\n i.height,\n i.submitter,\n i.[timestamp],\n i.contributors_email AS image_contributors_email,\n u.contributors_email AS upload_contributors_email,\n dc.owner_institution_code,\n dc.institution_code,\n dc.rights_holder,\n dc.collection_code,\n dc.collection_id,\n dc.dataset_name\n FROM\n dbo.darwin_cores dc LEFT JOIN\n dbo.image_set_uploads u ON dc.id = u.darwincore_id LEFT JOIN\n dbo.image_uploads_join j ON j.imagesetupload_id = u.id LEFT JOIN\n dbo.images i ON j.image_id = i.id LEFT JOIN\n dbo.bounding_boxes b ON b.image_id = i.id\n ;\n\n First generate the observation from the prompt and how will you generate thq query, then only generate the prompt. Make sure the sql query is inside ```\n If the prompt is asking about species or images of individual species, draft the sql in such a way that it generates json array containing the species data. Species data must contain species concept and bounding box id as id.\n\n Prompt: Find me an image containing both Aurelia aurita and Siphonophorae"}, {"role": "assistant", "content": "Observation:The prompt asks for an image of individual species so, You need to find the images from the database so you need to format the output such that it is a json and has species array that has species concept as concept, image url as url, image id as image_id and species bounding box id as id.\nAlso since you are showing images that has more than one species, add the bounding box data x, y, width, height.\nSince you need to output data as species array, first you will get the image id that has both concepts. After that you can search the database using the image id to generate the data in json format with id, concept, url, image_id, x, y, width and height values\n\nSql Query:```WITH ImageConcepts AS (\nSELECT TOP 1 i.id as image_id\nFROM dbo.images i\nWHERE \n EXISTS (\n SELECT 1\n FROM dbo.bounding_boxes b\n WHERE b.image_id = i.id AND b.concept = 'Aurelia aurita'\n )\n AND EXISTS (\n SELECT 1\n FROM dbo.bounding_boxes b\n WHERE b.image_id = i.id AND b.concept = 'Siphonophorae'\n )\nGROUP BY i.id)\nSELECT \n b.id,\n b.concept,\n i.url,\n i.id as image_id,\n b.x,\n b.y,\n b.width,\n b.height\nFROM \n dbo.images i\nJOIN \n dbo.bounding_boxes b ON i.id = b.image_id\nJOIN \n ImageConcepts c ON c.image_id = i.id\nWHERE \n b.concept IN ('Aurelia aurita', 'Siphonophorae')\nFOR JSON PATH```"}]}
{"messages": [{"role": "system", "content": "You are a text-to-sql generator. You have a database of marine species. The sql should be generated in a way such that the response from sql is a json. "}, {"role": "user", "content": "\n The database has the following structure.\n\n CREATE TABLE \"dbo\".\"bounding_box_comments\" (\n \"id\" \tbigint NOT NULL,\n \"bounding_box_uuid\" \tuniqueidentifier NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"email\" \tvarchar(254) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"text\" \tvarchar(2048) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"alternate_concept\" \tvarchar(255) NULL,\n \"flagged\" \tbit NULL,\n CONSTRAINT \"PK__bounding__3213E83F71625CCD\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"bounding_boxes\" (\n \"id\" \tbigint NOT NULL,\n \"concept\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"group_of\" \tbit NULL,\n \"height\" \tint NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"observer\" \tvarchar(256) NULL,\n \"occluded\" \tbit NULL,\n \"truncated\" \tbit NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"verification_timestamp\"\tdatetimeoffset(6) NULL,\n \"verified\" \tbit NULL,\n \"verifier\" \tvarchar(256) NULL,\n \"width\" \tint NULL,\n \"x\" \tint NULL,\n \"y\" \tint NULL,\n \"image_id\" \tbigint NULL,\n \"alt_concept\" \tvarchar(255) NULL,\n \"user_defined_key\" \tvarchar(56) NULL,\n CONSTRAINT \"PK__bounding__3213E83F3E4C2D08\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"bounding_boxes_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"concept\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"group_of\" \tbit NULL,\n \"height\" \tint NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"observer\" \tvarchar(256) NULL,\n \"occluded\" \tbit NULL,\n \"truncated\" \tbit NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"verification_timestamp\"\tdatetimeoffset(6) NULL,\n \"verified\" \tbit NULL,\n \"verifier\" \tvarchar(256) NULL,\n \"width\" \tint NULL,\n \"x\" \tint NULL,\n \"y\" \tint NULL,\n \"image_id\" \tbigint NULL,\n \"alt_concept\" \tvarchar(255) NULL,\n \"user_defined_key\" \tvarchar(56) NULL,\n CONSTRAINT \"PK__bounding__BE3894F99D30F28A\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"darwin_cores\" (\n \"id\" \tbigint NOT NULL,\n \"access_rights\" \tvarchar(1024) NULL,\n \"basis_of_record\" \tvarchar(64) NULL,\n \"bibliographic_citation\"\tvarchar(512) NULL,\n \"collection_code\" \tvarchar(64) NULL,\n \"collection_id\" \tvarchar(2048) NULL,\n \"data_generalizations\" \tvarchar(512) NULL,\n \"dataset_id\" \tuniqueidentifier NULL,\n \"dataset_name\" \tvarchar(255) NULL,\n \"dynamic_properties\" \tvarchar(2048) NULL,\n \"information_withheld\" \tvarchar(255) NULL,\n \"institution_code\" \tvarchar(255) NULL,\n \"institution_id\" \tvarchar(255) NULL,\n \"license\" \tvarchar(2048) NULL,\n \"modified\" \tdatetimeoffset(6) NULL,\n \"owner_institution_code\"\tvarchar(255) NULL,\n \"record_language\" \tvarchar(35) NULL,\n \"record_references\" \tvarchar(2048) NULL,\n \"record_type\" \tvarchar(32) NULL,\n \"rights_holder\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"image_set_upload_id\" \tbigint NULL,\n CONSTRAINT \"PK__darwin_c__3213E83F92DAE497\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"fathomnet_identities\" (\n \"id\" \tbigint NOT NULL,\n \"api_key\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"disabled\" \tbit NULL,\n \"display_name\" \tvarchar(255) NULL,\n \"email\" \tvarchar(255) NULL,\n \"expertise_rank\" \tvarchar(32) NULL,\n \"firebase_uid\" \tvarchar(255) NULL,\n \"job_title\" \tvarchar(255) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"organization\" \tvarchar(255) NULL,\n \"profile\" \tvarchar(1024) NULL,\n \"role_data\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"avatar_url\" \tvarchar(2000) NULL,\n \"orcid\" \tvarchar(32) NULL,\n \"notification_frequency\"\tvarchar(32) NULL,\n CONSTRAINT \"PK__fathomne__3213E83F59FE1468\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"fathomnet_identities_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"api_key\" \tvarchar(255) NULL,\n \"avatar_url\" \tvarchar(2000) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"disabled\" \tbit NULL,\n \"display_name\" \tvarchar(255) NULL,\n \"email\" \tvarchar(254) NULL,\n \"expertise_rank\" \tvarchar(32) NULL,\n \"firebase_uid\" \tvarchar(64) NULL,\n \"job_title\" \tvarchar(255) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"orcid\" \tvarchar(32) NULL,\n \"organization\" \tvarchar(255) NULL,\n \"profile\" \tvarchar(1024) NULL,\n \"role_data\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"notification_frequency\"\tvarchar(32) NULL,\n CONSTRAINT \"PK__fathomne__BE3894F9CD98EF78\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"followed_topics\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"email\" \tvarchar(254) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"notification\" \tbit NULL,\n \"target\" \tvarchar(256) NULL,\n \"topic\" \tvarchar(32) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n CONSTRAINT \"PK__followed__3213E83F4A1EA9E0\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"image_set_uploads\" (\n \"id\" \tbigint NOT NULL,\n \"contributors_email\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"format\" \tvarchar(255) NULL,\n \"last_updated_timestamp\" \tdatetime2(6) NULL,\n \"local_path\" \tvarchar(2048) NULL,\n \"rejection_details\" \tvarchar(255) NULL,\n \"rejection_reason\" \tvarchar(255) NULL,\n \"remote_uri\" \tvarchar(2048) NULL,\n \"sha256\" \tvarchar(64) NULL,\n \"status\" \tvarchar(255) NULL,\n \"status_update_timestamp\"\tdatetimeoffset(6) NULL,\n \"status_updater_email\" \tvarchar(254) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"darwincore_id\" \tbigint NULL,\n CONSTRAINT \"PK__image_se__3213E83F9C72A0E9\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"image_uploads_join\" (\n \"imagesetupload_id\"\tbigint NOT NULL,\n \"image_id\" \tbigint NOT NULL,\n CONSTRAINT \"PK__image_up__8A53EE0EBD9D776A\" PRIMARY KEY CLUSTERED(\"imagesetupload_id\",\"image_id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"images\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"depth_meters\" \tfloat NULL,\n \"height\" \tint NULL,\n \"imaging_type\" \tvarchar(64) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"last_validation\" \tdatetimeoffset(6) NULL,\n \"latitude\" \tfloat NULL,\n \"longitude\" \tfloat NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"modified\" \tdatetimeoffset(6) NULL,\n \"sha256\" \tvarchar(64) NULL,\n \"submitter\" \tvarchar(255) NULL,\n \"timestamp\" \tdatetimeoffset(6) NULL,\n \"url\" \tvarchar(2048) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"valid\" \tbit NULL,\n \"width\" \tint NULL,\n \"contributors_email\" \tvarchar(254) NULL,\n \"altitude\" \tfloat NULL,\n \"oxygen_ml_l\" \tfloat NULL,\n \"pressure_dbar\" \tfloat NULL,\n \"salinity\" \tfloat NULL,\n \"temperature_celsius\" \tfloat NULL,\n CONSTRAINT \"PK__images__3213E83FD76E309F\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"images_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"contributors_email\" \tvarchar(254) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"depth_meters\" \tfloat NULL,\n \"height\" \tint NULL,\n \"imaging_type\" \tvarchar(64) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"last_validation\" \tdatetimeoffset(6) NULL,\n \"latitude\" \tfloat NULL,\n \"longitude\" \tfloat NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"modified\" \tdatetimeoffset(6) NULL,\n \"sha256\" \tvarchar(64) NULL,\n \"timestamp\" \tdatetimeoffset(6) NULL,\n \"url\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"valid\" \tbit NULL,\n \"width\" \tint NULL,\n \"altitude\" \tfloat NULL,\n \"oxygen_ml_l\" \tfloat NULL,\n \"pressure_dbar\" \tfloat NULL,\n \"salinity\" \tfloat NULL,\n \"temperature_celsius\" \tfloat NULL,\n CONSTRAINT \"PK__images_a__BE3894F92DF6715C\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"marine_regions\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2 NULL,\n \"last_updated_timestamp\"\tdatetime2 NULL,\n \"max_latitude\" \tfloat NOT NULL,\n \"max_longitude\" \tfloat NOT NULL,\n \"min_latitude\" \tfloat NOT NULL,\n \"min_longitude\" \tfloat NOT NULL,\n \"mrgid\" \tbigint NULL,\n \"name\" \tvarchar(255) NULL,\n CONSTRAINT \"PK__marine_r__3213E83FE987FC8B\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"revinfo\" (\n \"rev\" \tint IDENTITY(1,1) NOT NULL,\n \"revtstmp\"\tbigint NULL,\n CONSTRAINT \"PK__revinfo__C2B7CC69D3938648\" PRIMARY KEY CLUSTERED(\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"tags\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2 NULL,\n \"tag\" \tvarchar(255) NOT NULL,\n \"last_updated_timestamp\"\tdatetime2 NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"value\" \tvarchar(255) NOT NULL,\n \"image_id\" \tbigint NULL,\n CONSTRAINT \"PK__tags__3213E83F3A490684\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"tags_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"created_timestamp\" \tdatetime2 NULL,\n \"tag\" \tvarchar(255) NULL,\n \"last_updated_timestamp\"\tdatetime2 NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"value\" \tvarchar(255) NULL,\n \"image_id\" \tbigint NULL,\n CONSTRAINT \"PK__tags_aud__BE3894F94F1608A8\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE VIEW \"dbo\".\"boundingbox_extended_info\" AS\n SELECT\n b.concept,\n b.alt_concept,\n b.observer,\n b.verified,\n b.verifier,\n b.verification_timestamp,\n b.user_defined_key,\n i.url,\n i.width,\n i.height,\n i.submitter,\n i.[timestamp],\n i.contributors_email AS image_contributors_email,\n u.contributors_email AS upload_contributors_email,\n dc.owner_institution_code,\n dc.institution_code,\n dc.rights_holder,\n dc.collection_code,\n dc.collection_id,\n dc.dataset_name\n FROM\n dbo.darwin_cores dc LEFT JOIN\n dbo.image_set_uploads u ON dc.id = u.darwincore_id LEFT JOIN\n dbo.image_uploads_join j ON j.imagesetupload_id = u.id LEFT JOIN\n dbo.images i ON j.image_id = i.id LEFT JOIN\n dbo.bounding_boxes b ON b.image_id = i.id\n ;\n\n First generate the observation from the prompt and how will you generate thq query, then only generate the prompt. Make sure the sql query is inside ```\n If the prompt is asking about species or images of individual species, draft the sql in such a way that it generates json array containing the species data. Species data must contain species concept and bounding box id as id.\n\n Prompt: What species are frequently found at 1000m depth?"}, {"role": "assistant", "content": "Observation:The prompt is asking the frequency of species found at depth of 1000m, so output freuqency data of species name with the frequency using the bounding_boxes and images table\n\nSql Query:```SELECT b.concept AS species, COUNT(*) AS frequency\nFROM dbo.bounding_boxes AS b\nJOIN dbo.images AS i ON b.image_id = i.id\nWHERE i.depth_meters = 1000\nGROUP BY b.concept\nORDER BY frequency DESC;```"}]}
{"messages": [{"role": "system", "content": "You are a text-to-sql generator. You have a database of marine species. The sql should be generated in a way such that the response from sql is a json. "}, {"role": "user", "content": "\n The database has the following structure.\n\n CREATE TABLE \"dbo\".\"bounding_box_comments\" (\n \"id\" \tbigint NOT NULL,\n \"bounding_box_uuid\" \tuniqueidentifier NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"email\" \tvarchar(254) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"text\" \tvarchar(2048) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"alternate_concept\" \tvarchar(255) NULL,\n \"flagged\" \tbit NULL,\n CONSTRAINT \"PK__bounding__3213E83F71625CCD\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"bounding_boxes\" (\n \"id\" \tbigint NOT NULL,\n \"concept\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"group_of\" \tbit NULL,\n \"height\" \tint NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"observer\" \tvarchar(256) NULL,\n \"occluded\" \tbit NULL,\n \"truncated\" \tbit NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"verification_timestamp\"\tdatetimeoffset(6) NULL,\n \"verified\" \tbit NULL,\n \"verifier\" \tvarchar(256) NULL,\n \"width\" \tint NULL,\n \"x\" \tint NULL,\n \"y\" \tint NULL,\n \"image_id\" \tbigint NULL,\n \"alt_concept\" \tvarchar(255) NULL,\n \"user_defined_key\" \tvarchar(56) NULL,\n CONSTRAINT \"PK__bounding__3213E83F3E4C2D08\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"bounding_boxes_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"concept\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"group_of\" \tbit NULL,\n \"height\" \tint NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"observer\" \tvarchar(256) NULL,\n \"occluded\" \tbit NULL,\n \"truncated\" \tbit NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"verification_timestamp\"\tdatetimeoffset(6) NULL,\n \"verified\" \tbit NULL,\n \"verifier\" \tvarchar(256) NULL,\n \"width\" \tint NULL,\n \"x\" \tint NULL,\n \"y\" \tint NULL,\n \"image_id\" \tbigint NULL,\n \"alt_concept\" \tvarchar(255) NULL,\n \"user_defined_key\" \tvarchar(56) NULL,\n CONSTRAINT \"PK__bounding__BE3894F99D30F28A\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"darwin_cores\" (\n \"id\" \tbigint NOT NULL,\n \"access_rights\" \tvarchar(1024) NULL,\n \"basis_of_record\" \tvarchar(64) NULL,\n \"bibliographic_citation\"\tvarchar(512) NULL,\n \"collection_code\" \tvarchar(64) NULL,\n \"collection_id\" \tvarchar(2048) NULL,\n \"data_generalizations\" \tvarchar(512) NULL,\n \"dataset_id\" \tuniqueidentifier NULL,\n \"dataset_name\" \tvarchar(255) NULL,\n \"dynamic_properties\" \tvarchar(2048) NULL,\n \"information_withheld\" \tvarchar(255) NULL,\n \"institution_code\" \tvarchar(255) NULL,\n \"institution_id\" \tvarchar(255) NULL,\n \"license\" \tvarchar(2048) NULL,\n \"modified\" \tdatetimeoffset(6) NULL,\n \"owner_institution_code\"\tvarchar(255) NULL,\n \"record_language\" \tvarchar(35) NULL,\n \"record_references\" \tvarchar(2048) NULL,\n \"record_type\" \tvarchar(32) NULL,\n \"rights_holder\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"image_set_upload_id\" \tbigint NULL,\n CONSTRAINT \"PK__darwin_c__3213E83F92DAE497\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"fathomnet_identities\" (\n \"id\" \tbigint NOT NULL,\n \"api_key\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"disabled\" \tbit NULL,\n \"display_name\" \tvarchar(255) NULL,\n \"email\" \tvarchar(255) NULL,\n \"expertise_rank\" \tvarchar(32) NULL,\n \"firebase_uid\" \tvarchar(255) NULL,\n \"job_title\" \tvarchar(255) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"organization\" \tvarchar(255) NULL,\n \"profile\" \tvarchar(1024) NULL,\n \"role_data\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"avatar_url\" \tvarchar(2000) NULL,\n \"orcid\" \tvarchar(32) NULL,\n \"notification_frequency\"\tvarchar(32) NULL,\n CONSTRAINT \"PK__fathomne__3213E83F59FE1468\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"fathomnet_identities_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"api_key\" \tvarchar(255) NULL,\n \"avatar_url\" \tvarchar(2000) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"disabled\" \tbit NULL,\n \"display_name\" \tvarchar(255) NULL,\n \"email\" \tvarchar(254) NULL,\n \"expertise_rank\" \tvarchar(32) NULL,\n \"firebase_uid\" \tvarchar(64) NULL,\n \"job_title\" \tvarchar(255) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"orcid\" \tvarchar(32) NULL,\n \"organization\" \tvarchar(255) NULL,\n \"profile\" \tvarchar(1024) NULL,\n \"role_data\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"notification_frequency\"\tvarchar(32) NULL,\n CONSTRAINT \"PK__fathomne__BE3894F9CD98EF78\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"followed_topics\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"email\" \tvarchar(254) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"notification\" \tbit NULL,\n \"target\" \tvarchar(256) NULL,\n \"topic\" \tvarchar(32) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n CONSTRAINT \"PK__followed__3213E83F4A1EA9E0\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"image_set_uploads\" (\n \"id\" \tbigint NOT NULL,\n \"contributors_email\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"format\" \tvarchar(255) NULL,\n \"last_updated_timestamp\" \tdatetime2(6) NULL,\n \"local_path\" \tvarchar(2048) NULL,\n \"rejection_details\" \tvarchar(255) NULL,\n \"rejection_reason\" \tvarchar(255) NULL,\n \"remote_uri\" \tvarchar(2048) NULL,\n \"sha256\" \tvarchar(64) NULL,\n \"status\" \tvarchar(255) NULL,\n \"status_update_timestamp\"\tdatetimeoffset(6) NULL,\n \"status_updater_email\" \tvarchar(254) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"darwincore_id\" \tbigint NULL,\n CONSTRAINT \"PK__image_se__3213E83F9C72A0E9\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"image_uploads_join\" (\n \"imagesetupload_id\"\tbigint NOT NULL,\n \"image_id\" \tbigint NOT NULL,\n CONSTRAINT \"PK__image_up__8A53EE0EBD9D776A\" PRIMARY KEY CLUSTERED(\"imagesetupload_id\",\"image_id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"images\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"depth_meters\" \tfloat NULL,\n \"height\" \tint NULL,\n \"imaging_type\" \tvarchar(64) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"last_validation\" \tdatetimeoffset(6) NULL,\n \"latitude\" \tfloat NULL,\n \"longitude\" \tfloat NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"modified\" \tdatetimeoffset(6) NULL,\n \"sha256\" \tvarchar(64) NULL,\n \"submitter\" \tvarchar(255) NULL,\n \"timestamp\" \tdatetimeoffset(6) NULL,\n \"url\" \tvarchar(2048) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"valid\" \tbit NULL,\n \"width\" \tint NULL,\n \"contributors_email\" \tvarchar(254) NULL,\n \"altitude\" \tfloat NULL,\n \"oxygen_ml_l\" \tfloat NULL,\n \"pressure_dbar\" \tfloat NULL,\n \"salinity\" \tfloat NULL,\n \"temperature_celsius\" \tfloat NULL,\n CONSTRAINT \"PK__images__3213E83FD76E309F\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"images_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"contributors_email\" \tvarchar(254) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"depth_meters\" \tfloat NULL,\n \"height\" \tint NULL,\n \"imaging_type\" \tvarchar(64) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"last_validation\" \tdatetimeoffset(6) NULL,\n \"latitude\" \tfloat NULL,\n \"longitude\" \tfloat NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"modified\" \tdatetimeoffset(6) NULL,\n \"sha256\" \tvarchar(64) NULL,\n \"timestamp\" \tdatetimeoffset(6) NULL,\n \"url\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"valid\" \tbit NULL,\n \"width\" \tint NULL,\n \"altitude\" \tfloat NULL,\n \"oxygen_ml_l\" \tfloat NULL,\n \"pressure_dbar\" \tfloat NULL,\n \"salinity\" \tfloat NULL,\n \"temperature_celsius\" \tfloat NULL,\n CONSTRAINT \"PK__images_a__BE3894F92DF6715C\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"marine_regions\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2 NULL,\n \"last_updated_timestamp\"\tdatetime2 NULL,\n \"max_latitude\" \tfloat NOT NULL,\n \"max_longitude\" \tfloat NOT NULL,\n \"min_latitude\" \tfloat NOT NULL,\n \"min_longitude\" \tfloat NOT NULL,\n \"mrgid\" \tbigint NULL,\n \"name\" \tvarchar(255) NULL,\n CONSTRAINT \"PK__marine_r__3213E83FE987FC8B\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"revinfo\" (\n \"rev\" \tint IDENTITY(1,1) NOT NULL,\n \"revtstmp\"\tbigint NULL,\n CONSTRAINT \"PK__revinfo__C2B7CC69D3938648\" PRIMARY KEY CLUSTERED(\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"tags\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2 NULL,\n \"tag\" \tvarchar(255) NOT NULL,\n \"last_updated_timestamp\"\tdatetime2 NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"value\" \tvarchar(255) NOT NULL,\n \"image_id\" \tbigint NULL,\n CONSTRAINT \"PK__tags__3213E83F3A490684\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"tags_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"created_timestamp\" \tdatetime2 NULL,\n \"tag\" \tvarchar(255) NULL,\n \"last_updated_timestamp\"\tdatetime2 NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"value\" \tvarchar(255) NULL,\n \"image_id\" \tbigint NULL,\n CONSTRAINT \"PK__tags_aud__BE3894F94F1608A8\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE VIEW \"dbo\".\"boundingbox_extended_info\" AS\n SELECT\n b.concept,\n b.alt_concept,\n b.observer,\n b.verified,\n b.verifier,\n b.verification_timestamp,\n b.user_defined_key,\n i.url,\n i.width,\n i.height,\n i.submitter,\n i.[timestamp],\n i.contributors_email AS image_contributors_email,\n u.contributors_email AS upload_contributors_email,\n dc.owner_institution_code,\n dc.institution_code,\n dc.rights_holder,\n dc.collection_code,\n dc.collection_id,\n dc.dataset_name\n FROM\n dbo.darwin_cores dc LEFT JOIN\n dbo.image_set_uploads u ON dc.id = u.darwincore_id LEFT JOIN\n dbo.image_uploads_join j ON j.imagesetupload_id = u.id LEFT JOIN\n dbo.images i ON j.image_id = i.id LEFT JOIN\n dbo.bounding_boxes b ON b.image_id = i.id\n ;\n\n First generate the observation from the prompt and how will you generate thq query, then only generate the prompt. Make sure the sql query is inside ```\n If the prompt is asking about species or images of individual species, draft the sql in such a way that it generates json array containing the species data. Species data must contain species concept and bounding box id as id.\n\n Prompt: How many distinct species are there at Monterey Bay?"}, {"role": "assistant", "content": "Observation:The species is asking for number of distinct species in Monterey Bay, so use the bounding_boxes and marine_regions table from database to find the number of species\n\nSql Query:```SELECT COUNT(DISTINCT b.concept) as DistinctSpeciesCount\nFROM dbo.bounding_boxes b\nWHERE EXISTS (\n SELECT 1\n FROM dbo.images i\n JOIN dbo.marine_regions mr ON i.latitude BETWEEN mr.min_latitude AND mr.max_latitude\n AND i.longitude BETWEEN mr.min_longitude AND mr.max_longitude\n WHERE mr.name = 'Monterey Bay'\n AND i.id = b.image_id\n)```"}]}
{"messages": [{"role": "system", "content": "You are a text-to-sql generator. You have a database of marine species. The sql should be generated in a way such that the response from sql is a json. "}, {"role": "user", "content": "\n The database has the following structure.\n\n CREATE TABLE \"dbo\".\"bounding_box_comments\" (\n \"id\" \tbigint NOT NULL,\n \"bounding_box_uuid\" \tuniqueidentifier NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"email\" \tvarchar(254) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"text\" \tvarchar(2048) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"alternate_concept\" \tvarchar(255) NULL,\n \"flagged\" \tbit NULL,\n CONSTRAINT \"PK__bounding__3213E83F71625CCD\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"bounding_boxes\" (\n \"id\" \tbigint NOT NULL,\n \"concept\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"group_of\" \tbit NULL,\n \"height\" \tint NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"observer\" \tvarchar(256) NULL,\n \"occluded\" \tbit NULL,\n \"truncated\" \tbit NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"verification_timestamp\"\tdatetimeoffset(6) NULL,\n \"verified\" \tbit NULL,\n \"verifier\" \tvarchar(256) NULL,\n \"width\" \tint NULL,\n \"x\" \tint NULL,\n \"y\" \tint NULL,\n \"image_id\" \tbigint NULL,\n \"alt_concept\" \tvarchar(255) NULL,\n \"user_defined_key\" \tvarchar(56) NULL,\n CONSTRAINT \"PK__bounding__3213E83F3E4C2D08\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"bounding_boxes_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"concept\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"group_of\" \tbit NULL,\n \"height\" \tint NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"observer\" \tvarchar(256) NULL,\n \"occluded\" \tbit NULL,\n \"truncated\" \tbit NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"verification_timestamp\"\tdatetimeoffset(6) NULL,\n \"verified\" \tbit NULL,\n \"verifier\" \tvarchar(256) NULL,\n \"width\" \tint NULL,\n \"x\" \tint NULL,\n \"y\" \tint NULL,\n \"image_id\" \tbigint NULL,\n \"alt_concept\" \tvarchar(255) NULL,\n \"user_defined_key\" \tvarchar(56) NULL,\n CONSTRAINT \"PK__bounding__BE3894F99D30F28A\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"darwin_cores\" (\n \"id\" \tbigint NOT NULL,\n \"access_rights\" \tvarchar(1024) NULL,\n \"basis_of_record\" \tvarchar(64) NULL,\n \"bibliographic_citation\"\tvarchar(512) NULL,\n \"collection_code\" \tvarchar(64) NULL,\n \"collection_id\" \tvarchar(2048) NULL,\n \"data_generalizations\" \tvarchar(512) NULL,\n \"dataset_id\" \tuniqueidentifier NULL,\n \"dataset_name\" \tvarchar(255) NULL,\n \"dynamic_properties\" \tvarchar(2048) NULL,\n \"information_withheld\" \tvarchar(255) NULL,\n \"institution_code\" \tvarchar(255) NULL,\n \"institution_id\" \tvarchar(255) NULL,\n \"license\" \tvarchar(2048) NULL,\n \"modified\" \tdatetimeoffset(6) NULL,\n \"owner_institution_code\"\tvarchar(255) NULL,\n \"record_language\" \tvarchar(35) NULL,\n \"record_references\" \tvarchar(2048) NULL,\n \"record_type\" \tvarchar(32) NULL,\n \"rights_holder\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"image_set_upload_id\" \tbigint NULL,\n CONSTRAINT \"PK__darwin_c__3213E83F92DAE497\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"fathomnet_identities\" (\n \"id\" \tbigint NOT NULL,\n \"api_key\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"disabled\" \tbit NULL,\n \"display_name\" \tvarchar(255) NULL,\n \"email\" \tvarchar(255) NULL,\n \"expertise_rank\" \tvarchar(32) NULL,\n \"firebase_uid\" \tvarchar(255) NULL,\n \"job_title\" \tvarchar(255) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"organization\" \tvarchar(255) NULL,\n \"profile\" \tvarchar(1024) NULL,\n \"role_data\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"avatar_url\" \tvarchar(2000) NULL,\n \"orcid\" \tvarchar(32) NULL,\n \"notification_frequency\"\tvarchar(32) NULL,\n CONSTRAINT \"PK__fathomne__3213E83F59FE1468\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"fathomnet_identities_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"api_key\" \tvarchar(255) NULL,\n \"avatar_url\" \tvarchar(2000) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"disabled\" \tbit NULL,\n \"display_name\" \tvarchar(255) NULL,\n \"email\" \tvarchar(254) NULL,\n \"expertise_rank\" \tvarchar(32) NULL,\n \"firebase_uid\" \tvarchar(64) NULL,\n \"job_title\" \tvarchar(255) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"orcid\" \tvarchar(32) NULL,\n \"organization\" \tvarchar(255) NULL,\n \"profile\" \tvarchar(1024) NULL,\n \"role_data\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"notification_frequency\"\tvarchar(32) NULL,\n CONSTRAINT \"PK__fathomne__BE3894F9CD98EF78\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"followed_topics\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"email\" \tvarchar(254) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"notification\" \tbit NULL,\n \"target\" \tvarchar(256) NULL,\n \"topic\" \tvarchar(32) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n CONSTRAINT \"PK__followed__3213E83F4A1EA9E0\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"image_set_uploads\" (\n \"id\" \tbigint NOT NULL,\n \"contributors_email\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"format\" \tvarchar(255) NULL,\n \"last_updated_timestamp\" \tdatetime2(6) NULL,\n \"local_path\" \tvarchar(2048) NULL,\n \"rejection_details\" \tvarchar(255) NULL,\n \"rejection_reason\" \tvarchar(255) NULL,\n \"remote_uri\" \tvarchar(2048) NULL,\n \"sha256\" \tvarchar(64) NULL,\n \"status\" \tvarchar(255) NULL,\n \"status_update_timestamp\"\tdatetimeoffset(6) NULL,\n \"status_updater_email\" \tvarchar(254) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"darwincore_id\" \tbigint NULL,\n CONSTRAINT \"PK__image_se__3213E83F9C72A0E9\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"image_uploads_join\" (\n \"imagesetupload_id\"\tbigint NOT NULL,\n \"image_id\" \tbigint NOT NULL,\n CONSTRAINT \"PK__image_up__8A53EE0EBD9D776A\" PRIMARY KEY CLUSTERED(\"imagesetupload_id\",\"image_id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"images\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"depth_meters\" \tfloat NULL,\n \"height\" \tint NULL,\n \"imaging_type\" \tvarchar(64) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"last_validation\" \tdatetimeoffset(6) NULL,\n \"latitude\" \tfloat NULL,\n \"longitude\" \tfloat NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"modified\" \tdatetimeoffset(6) NULL,\n \"sha256\" \tvarchar(64) NULL,\n \"submitter\" \tvarchar(255) NULL,\n \"timestamp\" \tdatetimeoffset(6) NULL,\n \"url\" \tvarchar(2048) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"valid\" \tbit NULL,\n \"width\" \tint NULL,\n \"contributors_email\" \tvarchar(254) NULL,\n \"altitude\" \tfloat NULL,\n \"oxygen_ml_l\" \tfloat NULL,\n \"pressure_dbar\" \tfloat NULL,\n \"salinity\" \tfloat NULL,\n \"temperature_celsius\" \tfloat NULL,\n CONSTRAINT \"PK__images__3213E83FD76E309F\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"images_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"contributors_email\" \tvarchar(254) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"depth_meters\" \tfloat NULL,\n \"height\" \tint NULL,\n \"imaging_type\" \tvarchar(64) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"last_validation\" \tdatetimeoffset(6) NULL,\n \"latitude\" \tfloat NULL,\n \"longitude\" \tfloat NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"modified\" \tdatetimeoffset(6) NULL,\n \"sha256\" \tvarchar(64) NULL,\n \"timestamp\" \tdatetimeoffset(6) NULL,\n \"url\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"valid\" \tbit NULL,\n \"width\" \tint NULL,\n \"altitude\" \tfloat NULL,\n \"oxygen_ml_l\" \tfloat NULL,\n \"pressure_dbar\" \tfloat NULL,\n \"salinity\" \tfloat NULL,\n \"temperature_celsius\" \tfloat NULL,\n CONSTRAINT \"PK__images_a__BE3894F92DF6715C\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"marine_regions\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2 NULL,\n \"last_updated_timestamp\"\tdatetime2 NULL,\n \"max_latitude\" \tfloat NOT NULL,\n \"max_longitude\" \tfloat NOT NULL,\n \"min_latitude\" \tfloat NOT NULL,\n \"min_longitude\" \tfloat NOT NULL,\n \"mrgid\" \tbigint NULL,\n \"name\" \tvarchar(255) NULL,\n CONSTRAINT \"PK__marine_r__3213E83FE987FC8B\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"revinfo\" (\n \"rev\" \tint IDENTITY(1,1) NOT NULL,\n \"revtstmp\"\tbigint NULL,\n CONSTRAINT \"PK__revinfo__C2B7CC69D3938648\" PRIMARY KEY CLUSTERED(\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"tags\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2 NULL,\n \"tag\" \tvarchar(255) NOT NULL,\n \"last_updated_timestamp\"\tdatetime2 NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"value\" \tvarchar(255) NOT NULL,\n \"image_id\" \tbigint NULL,\n CONSTRAINT \"PK__tags__3213E83F3A490684\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"tags_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"created_timestamp\" \tdatetime2 NULL,\n \"tag\" \tvarchar(255) NULL,\n \"last_updated_timestamp\"\tdatetime2 NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"value\" \tvarchar(255) NULL,\n \"image_id\" \tbigint NULL,\n CONSTRAINT \"PK__tags_aud__BE3894F94F1608A8\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE VIEW \"dbo\".\"boundingbox_extended_info\" AS\n SELECT\n b.concept,\n b.alt_concept,\n b.observer,\n b.verified,\n b.verifier,\n b.verification_timestamp,\n b.user_defined_key,\n i.url,\n i.width,\n i.height,\n i.submitter,\n i.[timestamp],\n i.contributors_email AS image_contributors_email,\n u.contributors_email AS upload_contributors_email,\n dc.owner_institution_code,\n dc.institution_code,\n dc.rights_holder,\n dc.collection_code,\n dc.collection_id,\n dc.dataset_name\n FROM\n dbo.darwin_cores dc LEFT JOIN\n dbo.image_set_uploads u ON dc.id = u.darwincore_id LEFT JOIN\n dbo.image_uploads_join j ON j.imagesetupload_id = u.id LEFT JOIN\n dbo.images i ON j.image_id = i.id LEFT JOIN\n dbo.bounding_boxes b ON b.image_id = i.id\n ;\n\n First generate the observation from the prompt and how will you generate thq query, then only generate the prompt. Make sure the sql query is inside ```\n If the prompt is asking about species or images of individual species, draft the sql in such a way that it generates json array containing the species data. Species data must contain species concept and bounding box id as id.\n\n Prompt: Find me images of Aurelia aurita that looks good\n"}, {"role": "assistant", "content": "Observation:The prompt asks for images of individual species so, You need to find the images from the database so you need to format the output such that it is a json and has species array that has species concept as concept, image url as url, image id as image_id and species bounding box id as id.\nSince the prompt is asking for image that looks good without specifying what type of image would look good, find images that has highest bounding box width, height to image width, height ratio and show 10 top results\n\nSql Query:```SELECT TOP 10 i.url, b.concept, b.id, i.id as image_id\nFROM dbo.bounding_boxes AS b\nJOIN dbo.images AS i ON b.image_id = i.id\nWHERE b.concept = 'Aurelia aurita'\nORDER BY (b.width * b.height) / (i.width * i.height) DESC\nFOR JSON PATH```"}]}
{"messages": [{"role": "system", "content": "You are a text-to-sql generator. You have a database of marine species. The sql should be generated in a way such that the response from sql is a json. "}, {"role": "user", "content": "\n The database has the following structure.\n\n CREATE TABLE \"dbo\".\"bounding_box_comments\" (\n \"id\" \tbigint NOT NULL,\n \"bounding_box_uuid\" \tuniqueidentifier NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"email\" \tvarchar(254) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"text\" \tvarchar(2048) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"alternate_concept\" \tvarchar(255) NULL,\n \"flagged\" \tbit NULL,\n CONSTRAINT \"PK__bounding__3213E83F71625CCD\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"bounding_boxes\" (\n \"id\" \tbigint NOT NULL,\n \"concept\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"group_of\" \tbit NULL,\n \"height\" \tint NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"observer\" \tvarchar(256) NULL,\n \"occluded\" \tbit NULL,\n \"truncated\" \tbit NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"verification_timestamp\"\tdatetimeoffset(6) NULL,\n \"verified\" \tbit NULL,\n \"verifier\" \tvarchar(256) NULL,\n \"width\" \tint NULL,\n \"x\" \tint NULL,\n \"y\" \tint NULL,\n \"image_id\" \tbigint NULL,\n \"alt_concept\" \tvarchar(255) NULL,\n \"user_defined_key\" \tvarchar(56) NULL,\n CONSTRAINT \"PK__bounding__3213E83F3E4C2D08\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"bounding_boxes_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"concept\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"group_of\" \tbit NULL,\n \"height\" \tint NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"observer\" \tvarchar(256) NULL,\n \"occluded\" \tbit NULL,\n \"truncated\" \tbit NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"verification_timestamp\"\tdatetimeoffset(6) NULL,\n \"verified\" \tbit NULL,\n \"verifier\" \tvarchar(256) NULL,\n \"width\" \tint NULL,\n \"x\" \tint NULL,\n \"y\" \tint NULL,\n \"image_id\" \tbigint NULL,\n \"alt_concept\" \tvarchar(255) NULL,\n \"user_defined_key\" \tvarchar(56) NULL,\n CONSTRAINT \"PK__bounding__BE3894F99D30F28A\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"darwin_cores\" (\n \"id\" \tbigint NOT NULL,\n \"access_rights\" \tvarchar(1024) NULL,\n \"basis_of_record\" \tvarchar(64) NULL,\n \"bibliographic_citation\"\tvarchar(512) NULL,\n \"collection_code\" \tvarchar(64) NULL,\n \"collection_id\" \tvarchar(2048) NULL,\n \"data_generalizations\" \tvarchar(512) NULL,\n \"dataset_id\" \tuniqueidentifier NULL,\n \"dataset_name\" \tvarchar(255) NULL,\n \"dynamic_properties\" \tvarchar(2048) NULL,\n \"information_withheld\" \tvarchar(255) NULL,\n \"institution_code\" \tvarchar(255) NULL,\n \"institution_id\" \tvarchar(255) NULL,\n \"license\" \tvarchar(2048) NULL,\n \"modified\" \tdatetimeoffset(6) NULL,\n \"owner_institution_code\"\tvarchar(255) NULL,\n \"record_language\" \tvarchar(35) NULL,\n \"record_references\" \tvarchar(2048) NULL,\n \"record_type\" \tvarchar(32) NULL,\n \"rights_holder\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"image_set_upload_id\" \tbigint NULL,\n CONSTRAINT \"PK__darwin_c__3213E83F92DAE497\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"fathomnet_identities\" (\n \"id\" \tbigint NOT NULL,\n \"api_key\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"disabled\" \tbit NULL,\n \"display_name\" \tvarchar(255) NULL,\n \"email\" \tvarchar(255) NULL,\n \"expertise_rank\" \tvarchar(32) NULL,\n \"firebase_uid\" \tvarchar(255) NULL,\n \"job_title\" \tvarchar(255) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"organization\" \tvarchar(255) NULL,\n \"profile\" \tvarchar(1024) NULL,\n \"role_data\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"avatar_url\" \tvarchar(2000) NULL,\n \"orcid\" \tvarchar(32) NULL,\n \"notification_frequency\"\tvarchar(32) NULL,\n CONSTRAINT \"PK__fathomne__3213E83F59FE1468\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"fathomnet_identities_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"api_key\" \tvarchar(255) NULL,\n \"avatar_url\" \tvarchar(2000) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"disabled\" \tbit NULL,\n \"display_name\" \tvarchar(255) NULL,\n \"email\" \tvarchar(254) NULL,\n \"expertise_rank\" \tvarchar(32) NULL,\n \"firebase_uid\" \tvarchar(64) NULL,\n \"job_title\" \tvarchar(255) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"orcid\" \tvarchar(32) NULL,\n \"organization\" \tvarchar(255) NULL,\n \"profile\" \tvarchar(1024) NULL,\n \"role_data\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"notification_frequency\"\tvarchar(32) NULL,\n CONSTRAINT \"PK__fathomne__BE3894F9CD98EF78\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"followed_topics\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"email\" \tvarchar(254) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"notification\" \tbit NULL,\n \"target\" \tvarchar(256) NULL,\n \"topic\" \tvarchar(32) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n CONSTRAINT \"PK__followed__3213E83F4A1EA9E0\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"image_set_uploads\" (\n \"id\" \tbigint NOT NULL,\n \"contributors_email\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"format\" \tvarchar(255) NULL,\n \"last_updated_timestamp\" \tdatetime2(6) NULL,\n \"local_path\" \tvarchar(2048) NULL,\n \"rejection_details\" \tvarchar(255) NULL,\n \"rejection_reason\" \tvarchar(255) NULL,\n \"remote_uri\" \tvarchar(2048) NULL,\n \"sha256\" \tvarchar(64) NULL,\n \"status\" \tvarchar(255) NULL,\n \"status_update_timestamp\"\tdatetimeoffset(6) NULL,\n \"status_updater_email\" \tvarchar(254) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"darwincore_id\" \tbigint NULL,\n CONSTRAINT \"PK__image_se__3213E83F9C72A0E9\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"image_uploads_join\" (\n \"imagesetupload_id\"\tbigint NOT NULL,\n \"image_id\" \tbigint NOT NULL,\n CONSTRAINT \"PK__image_up__8A53EE0EBD9D776A\" PRIMARY KEY CLUSTERED(\"imagesetupload_id\",\"image_id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"images\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"depth_meters\" \tfloat NULL,\n \"height\" \tint NULL,\n \"imaging_type\" \tvarchar(64) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"last_validation\" \tdatetimeoffset(6) NULL,\n \"latitude\" \tfloat NULL,\n \"longitude\" \tfloat NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"modified\" \tdatetimeoffset(6) NULL,\n \"sha256\" \tvarchar(64) NULL,\n \"submitter\" \tvarchar(255) NULL,\n \"timestamp\" \tdatetimeoffset(6) NULL,\n \"url\" \tvarchar(2048) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"valid\" \tbit NULL,\n \"width\" \tint NULL,\n \"contributors_email\" \tvarchar(254) NULL,\n \"altitude\" \tfloat NULL,\n \"oxygen_ml_l\" \tfloat NULL,\n \"pressure_dbar\" \tfloat NULL,\n \"salinity\" \tfloat NULL,\n \"temperature_celsius\" \tfloat NULL,\n CONSTRAINT \"PK__images__3213E83FD76E309F\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"images_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"contributors_email\" \tvarchar(254) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"depth_meters\" \tfloat NULL,\n \"height\" \tint NULL,\n \"imaging_type\" \tvarchar(64) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"last_validation\" \tdatetimeoffset(6) NULL,\n \"latitude\" \tfloat NULL,\n \"longitude\" \tfloat NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"modified\" \tdatetimeoffset(6) NULL,\n \"sha256\" \tvarchar(64) NULL,\n \"timestamp\" \tdatetimeoffset(6) NULL,\n \"url\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"valid\" \tbit NULL,\n \"width\" \tint NULL,\n \"altitude\" \tfloat NULL,\n \"oxygen_ml_l\" \tfloat NULL,\n \"pressure_dbar\" \tfloat NULL,\n \"salinity\" \tfloat NULL,\n \"temperature_celsius\" \tfloat NULL,\n CONSTRAINT \"PK__images_a__BE3894F92DF6715C\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"marine_regions\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2 NULL,\n \"last_updated_timestamp\"\tdatetime2 NULL,\n \"max_latitude\" \tfloat NOT NULL,\n \"max_longitude\" \tfloat NOT NULL,\n \"min_latitude\" \tfloat NOT NULL,\n \"min_longitude\" \tfloat NOT NULL,\n \"mrgid\" \tbigint NULL,\n \"name\" \tvarchar(255) NULL,\n CONSTRAINT \"PK__marine_r__3213E83FE987FC8B\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"revinfo\" (\n \"rev\" \tint IDENTITY(1,1) NOT NULL,\n \"revtstmp\"\tbigint NULL,\n CONSTRAINT \"PK__revinfo__C2B7CC69D3938648\" PRIMARY KEY CLUSTERED(\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"tags\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2 NULL,\n \"tag\" \tvarchar(255) NOT NULL,\n \"last_updated_timestamp\"\tdatetime2 NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"value\" \tvarchar(255) NOT NULL,\n \"image_id\" \tbigint NULL,\n CONSTRAINT \"PK__tags__3213E83F3A490684\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"tags_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"created_timestamp\" \tdatetime2 NULL,\n \"tag\" \tvarchar(255) NULL,\n \"last_updated_timestamp\"\tdatetime2 NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"value\" \tvarchar(255) NULL,\n \"image_id\" \tbigint NULL,\n CONSTRAINT \"PK__tags_aud__BE3894F94F1608A8\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE VIEW \"dbo\".\"boundingbox_extended_info\" AS\n SELECT\n b.concept,\n b.alt_concept,\n b.observer,\n b.verified,\n b.verifier,\n b.verification_timestamp,\n b.user_defined_key,\n i.url,\n i.width,\n i.height,\n i.submitter,\n i.[timestamp],\n i.contributors_email AS image_contributors_email,\n u.contributors_email AS upload_contributors_email,\n dc.owner_institution_code,\n dc.institution_code,\n dc.rights_holder,\n dc.collection_code,\n dc.collection_id,\n dc.dataset_name\n FROM\n dbo.darwin_cores dc LEFT JOIN\n dbo.image_set_uploads u ON dc.id = u.darwincore_id LEFT JOIN\n dbo.image_uploads_join j ON j.imagesetupload_id = u.id LEFT JOIN\n dbo.images i ON j.image_id = i.id LEFT JOIN\n dbo.bounding_boxes b ON b.image_id = i.id\n ;\n\n First generate the observation from the prompt and how will you generate thq query, then only generate the prompt. Make sure the sql query is inside ```\n If the prompt is asking about species or images of individual species, draft the sql in such a way that it generates json array containing the species data. Species data must contain species concept and bounding box id as id.\n\n Prompt: Give data of all species in Monterey Bay to show in a heatmap"}, {"role": "assistant", "content": "Observation:The prompt asks to give data of all species in Monterey Bay to show in a heatmap. So, You need to find the images from the database so you need to format the output such that it is a json and has species array that has species concept as concept and species bounding box id as id.\nAlso since the data will be shown in a heatmap, location data is very important, so you will add the latitude, longitude and depth data of the species. \nSql Query:```SELECT\n b.concept,\n b.id,\n i.latitude,\n i.longitude,\n i.depth_meters\nFROM\n dbo.bounding_boxes b\n JOIN dbo.images i ON b.image_id = i.id\n JOIN dbo.marine_regions mr ON i.latitude BETWEEN mr.min_latitude AND mr.max_latitude\n AND i.longitude BETWEEN mr.min_longitude AND mr.max_longitude\nWHERE\n mr.name = 'Monterey Bay'\nFOR JSON PATH```"}]}
{"messages": [{"role": "system", "content": "You are a text-to-sql generator. You have a database of marine species. The sql should be generated in a way such that the response from sql is a json. "}, {"role": "user", "content": "\n The database has the following structure.\n\n CREATE TABLE \"dbo\".\"bounding_box_comments\" (\n \"id\" \tbigint NOT NULL,\n \"bounding_box_uuid\" \tuniqueidentifier NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"email\" \tvarchar(254) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"text\" \tvarchar(2048) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"alternate_concept\" \tvarchar(255) NULL,\n \"flagged\" \tbit NULL,\n CONSTRAINT \"PK__bounding__3213E83F71625CCD\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"bounding_boxes\" (\n \"id\" \tbigint NOT NULL,\n \"concept\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"group_of\" \tbit NULL,\n \"height\" \tint NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"observer\" \tvarchar(256) NULL,\n \"occluded\" \tbit NULL,\n \"truncated\" \tbit NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"verification_timestamp\"\tdatetimeoffset(6) NULL,\n \"verified\" \tbit NULL,\n \"verifier\" \tvarchar(256) NULL,\n \"width\" \tint NULL,\n \"x\" \tint NULL,\n \"y\" \tint NULL,\n \"image_id\" \tbigint NULL,\n \"alt_concept\" \tvarchar(255) NULL,\n \"user_defined_key\" \tvarchar(56) NULL,\n CONSTRAINT \"PK__bounding__3213E83F3E4C2D08\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"bounding_boxes_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"concept\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"group_of\" \tbit NULL,\n \"height\" \tint NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"observer\" \tvarchar(256) NULL,\n \"occluded\" \tbit NULL,\n \"truncated\" \tbit NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"verification_timestamp\"\tdatetimeoffset(6) NULL,\n \"verified\" \tbit NULL,\n \"verifier\" \tvarchar(256) NULL,\n \"width\" \tint NULL,\n \"x\" \tint NULL,\n \"y\" \tint NULL,\n \"image_id\" \tbigint NULL,\n \"alt_concept\" \tvarchar(255) NULL,\n \"user_defined_key\" \tvarchar(56) NULL,\n CONSTRAINT \"PK__bounding__BE3894F99D30F28A\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"darwin_cores\" (\n \"id\" \tbigint NOT NULL,\n \"access_rights\" \tvarchar(1024) NULL,\n \"basis_of_record\" \tvarchar(64) NULL,\n \"bibliographic_citation\"\tvarchar(512) NULL,\n \"collection_code\" \tvarchar(64) NULL,\n \"collection_id\" \tvarchar(2048) NULL,\n \"data_generalizations\" \tvarchar(512) NULL,\n \"dataset_id\" \tuniqueidentifier NULL,\n \"dataset_name\" \tvarchar(255) NULL,\n \"dynamic_properties\" \tvarchar(2048) NULL,\n \"information_withheld\" \tvarchar(255) NULL,\n \"institution_code\" \tvarchar(255) NULL,\n \"institution_id\" \tvarchar(255) NULL,\n \"license\" \tvarchar(2048) NULL,\n \"modified\" \tdatetimeoffset(6) NULL,\n \"owner_institution_code\"\tvarchar(255) NULL,\n \"record_language\" \tvarchar(35) NULL,\n \"record_references\" \tvarchar(2048) NULL,\n \"record_type\" \tvarchar(32) NULL,\n \"rights_holder\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"image_set_upload_id\" \tbigint NULL,\n CONSTRAINT \"PK__darwin_c__3213E83F92DAE497\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"fathomnet_identities\" (\n \"id\" \tbigint NOT NULL,\n \"api_key\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"disabled\" \tbit NULL,\n \"display_name\" \tvarchar(255) NULL,\n \"email\" \tvarchar(255) NULL,\n \"expertise_rank\" \tvarchar(32) NULL,\n \"firebase_uid\" \tvarchar(255) NULL,\n \"job_title\" \tvarchar(255) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"organization\" \tvarchar(255) NULL,\n \"profile\" \tvarchar(1024) NULL,\n \"role_data\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"avatar_url\" \tvarchar(2000) NULL,\n \"orcid\" \tvarchar(32) NULL,\n \"notification_frequency\"\tvarchar(32) NULL,\n CONSTRAINT \"PK__fathomne__3213E83F59FE1468\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"fathomnet_identities_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"api_key\" \tvarchar(255) NULL,\n \"avatar_url\" \tvarchar(2000) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"disabled\" \tbit NULL,\n \"display_name\" \tvarchar(255) NULL,\n \"email\" \tvarchar(254) NULL,\n \"expertise_rank\" \tvarchar(32) NULL,\n \"firebase_uid\" \tvarchar(64) NULL,\n \"job_title\" \tvarchar(255) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"orcid\" \tvarchar(32) NULL,\n \"organization\" \tvarchar(255) NULL,\n \"profile\" \tvarchar(1024) NULL,\n \"role_data\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"notification_frequency\"\tvarchar(32) NULL,\n CONSTRAINT \"PK__fathomne__BE3894F9CD98EF78\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"followed_topics\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"email\" \tvarchar(254) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"notification\" \tbit NULL,\n \"target\" \tvarchar(256) NULL,\n \"topic\" \tvarchar(32) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n CONSTRAINT \"PK__followed__3213E83F4A1EA9E0\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"image_set_uploads\" (\n \"id\" \tbigint NOT NULL,\n \"contributors_email\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"format\" \tvarchar(255) NULL,\n \"last_updated_timestamp\" \tdatetime2(6) NULL,\n \"local_path\" \tvarchar(2048) NULL,\n \"rejection_details\" \tvarchar(255) NULL,\n \"rejection_reason\" \tvarchar(255) NULL,\n \"remote_uri\" \tvarchar(2048) NULL,\n \"sha256\" \tvarchar(64) NULL,\n \"status\" \tvarchar(255) NULL,\n \"status_update_timestamp\"\tdatetimeoffset(6) NULL,\n \"status_updater_email\" \tvarchar(254) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"darwincore_id\" \tbigint NULL,\n CONSTRAINT \"PK__image_se__3213E83F9C72A0E9\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"image_uploads_join\" (\n \"imagesetupload_id\"\tbigint NOT NULL,\n \"image_id\" \tbigint NOT NULL,\n CONSTRAINT \"PK__image_up__8A53EE0EBD9D776A\" PRIMARY KEY CLUSTERED(\"imagesetupload_id\",\"image_id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"images\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"depth_meters\" \tfloat NULL,\n \"height\" \tint NULL,\n \"imaging_type\" \tvarchar(64) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"last_validation\" \tdatetimeoffset(6) NULL,\n \"latitude\" \tfloat NULL,\n \"longitude\" \tfloat NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"modified\" \tdatetimeoffset(6) NULL,\n \"sha256\" \tvarchar(64) NULL,\n \"submitter\" \tvarchar(255) NULL,\n \"timestamp\" \tdatetimeoffset(6) NULL,\n \"url\" \tvarchar(2048) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"valid\" \tbit NULL,\n \"width\" \tint NULL,\n \"contributors_email\" \tvarchar(254) NULL,\n \"altitude\" \tfloat NULL,\n \"oxygen_ml_l\" \tfloat NULL,\n \"pressure_dbar\" \tfloat NULL,\n \"salinity\" \tfloat NULL,\n \"temperature_celsius\" \tfloat NULL,\n CONSTRAINT \"PK__images__3213E83FD76E309F\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"images_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"contributors_email\" \tvarchar(254) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"depth_meters\" \tfloat NULL,\n \"height\" \tint NULL,\n \"imaging_type\" \tvarchar(64) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"last_validation\" \tdatetimeoffset(6) NULL,\n \"latitude\" \tfloat NULL,\n \"longitude\" \tfloat NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"modified\" \tdatetimeoffset(6) NULL,\n \"sha256\" \tvarchar(64) NULL,\n \"timestamp\" \tdatetimeoffset(6) NULL,\n \"url\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"valid\" \tbit NULL,\n \"width\" \tint NULL,\n \"altitude\" \tfloat NULL,\n \"oxygen_ml_l\" \tfloat NULL,\n \"pressure_dbar\" \tfloat NULL,\n \"salinity\" \tfloat NULL,\n \"temperature_celsius\" \tfloat NULL,\n CONSTRAINT \"PK__images_a__BE3894F92DF6715C\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"marine_regions\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2 NULL,\n \"last_updated_timestamp\"\tdatetime2 NULL,\n \"max_latitude\" \tfloat NOT NULL,\n \"max_longitude\" \tfloat NOT NULL,\n \"min_latitude\" \tfloat NOT NULL,\n \"min_longitude\" \tfloat NOT NULL,\n \"mrgid\" \tbigint NULL,\n \"name\" \tvarchar(255) NULL,\n CONSTRAINT \"PK__marine_r__3213E83FE987FC8B\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"revinfo\" (\n \"rev\" \tint IDENTITY(1,1) NOT NULL,\n \"revtstmp\"\tbigint NULL,\n CONSTRAINT \"PK__revinfo__C2B7CC69D3938648\" PRIMARY KEY CLUSTERED(\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"tags\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2 NULL,\n \"tag\" \tvarchar(255) NOT NULL,\n \"last_updated_timestamp\"\tdatetime2 NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"value\" \tvarchar(255) NOT NULL,\n \"image_id\" \tbigint NULL,\n CONSTRAINT \"PK__tags__3213E83F3A490684\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"tags_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"created_timestamp\" \tdatetime2 NULL,\n \"tag\" \tvarchar(255) NULL,\n \"last_updated_timestamp\"\tdatetime2 NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"value\" \tvarchar(255) NULL,\n \"image_id\" \tbigint NULL,\n CONSTRAINT \"PK__tags_aud__BE3894F94F1608A8\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE VIEW \"dbo\".\"boundingbox_extended_info\" AS\n SELECT\n b.concept,\n b.alt_concept,\n b.observer,\n b.verified,\n b.verifier,\n b.verification_timestamp,\n b.user_defined_key,\n i.url,\n i.width,\n i.height,\n i.submitter,\n i.[timestamp],\n i.contributors_email AS image_contributors_email,\n u.contributors_email AS upload_contributors_email,\n dc.owner_institution_code,\n dc.institution_code,\n dc.rights_holder,\n dc.collection_code,\n dc.collection_id,\n dc.dataset_name\n FROM\n dbo.darwin_cores dc LEFT JOIN\n dbo.image_set_uploads u ON dc.id = u.darwincore_id LEFT JOIN\n dbo.image_uploads_join j ON j.imagesetupload_id = u.id LEFT JOIN\n dbo.images i ON j.image_id = i.id LEFT JOIN\n dbo.bounding_boxes b ON b.image_id = i.id\n ;\n\n First generate the observation from the prompt and how will you generate thq query, then only generate the prompt. Make sure the sql query is inside ```\n If the prompt is asking about species or images of individual species, draft the sql in such a way that it generates json array containing the species data. Species data must contain species concept and bounding box id as id.\n\n Prompt: Find me a place where Aurelia aurita is found the most"}, {"role": "assistant", "content": "Observation:Since the prompt is asking about the place where Aurelia aurita is found the most without specifying any region, you can use the marine_regions table along with the bounding_boxes table to find out the number of that species in a region. After that you can sort the data and get the result.\n\nSql Query:```SELECT TOP 1 mr.name as region_name, COUNT(bb.id) as count\nFROM dbo.bounding_boxes bb\nJOIN dbo.images i ON bb.image_id = i.id\nJOIN dbo.marine_regions mr ON i.latitude BETWEEN mr.min_latitude AND mr.max_latitude AND i.longitude BETWEEN mr.min_longitude AND mr.max_longitude\nWHERE bb.concept = 'Aurelia aurita'\nGROUP BY mr.name\nORDER BY count DESC```"}]}
{"messages": [{"role": "system", "content": "You are a text-to-sql generator. You have a database of marine species. The sql should be generated in a way such that the response from sql is a json. "}, {"role": "user", "content": "\n The database has the following structure.\n\n CREATE TABLE \"dbo\".\"bounding_box_comments\" (\n \"id\" \tbigint NOT NULL,\n \"bounding_box_uuid\" \tuniqueidentifier NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"email\" \tvarchar(254) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"text\" \tvarchar(2048) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"alternate_concept\" \tvarchar(255) NULL,\n \"flagged\" \tbit NULL,\n CONSTRAINT \"PK__bounding__3213E83F71625CCD\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"bounding_boxes\" (\n \"id\" \tbigint NOT NULL,\n \"concept\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"group_of\" \tbit NULL,\n \"height\" \tint NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"observer\" \tvarchar(256) NULL,\n \"occluded\" \tbit NULL,\n \"truncated\" \tbit NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"verification_timestamp\"\tdatetimeoffset(6) NULL,\n \"verified\" \tbit NULL,\n \"verifier\" \tvarchar(256) NULL,\n \"width\" \tint NULL,\n \"x\" \tint NULL,\n \"y\" \tint NULL,\n \"image_id\" \tbigint NULL,\n \"alt_concept\" \tvarchar(255) NULL,\n \"user_defined_key\" \tvarchar(56) NULL,\n CONSTRAINT \"PK__bounding__3213E83F3E4C2D08\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"bounding_boxes_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"concept\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"group_of\" \tbit NULL,\n \"height\" \tint NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"observer\" \tvarchar(256) NULL,\n \"occluded\" \tbit NULL,\n \"truncated\" \tbit NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"verification_timestamp\"\tdatetimeoffset(6) NULL,\n \"verified\" \tbit NULL,\n \"verifier\" \tvarchar(256) NULL,\n \"width\" \tint NULL,\n \"x\" \tint NULL,\n \"y\" \tint NULL,\n \"image_id\" \tbigint NULL,\n \"alt_concept\" \tvarchar(255) NULL,\n \"user_defined_key\" \tvarchar(56) NULL,\n CONSTRAINT \"PK__bounding__BE3894F99D30F28A\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"darwin_cores\" (\n \"id\" \tbigint NOT NULL,\n \"access_rights\" \tvarchar(1024) NULL,\n \"basis_of_record\" \tvarchar(64) NULL,\n \"bibliographic_citation\"\tvarchar(512) NULL,\n \"collection_code\" \tvarchar(64) NULL,\n \"collection_id\" \tvarchar(2048) NULL,\n \"data_generalizations\" \tvarchar(512) NULL,\n \"dataset_id\" \tuniqueidentifier NULL,\n \"dataset_name\" \tvarchar(255) NULL,\n \"dynamic_properties\" \tvarchar(2048) NULL,\n \"information_withheld\" \tvarchar(255) NULL,\n \"institution_code\" \tvarchar(255) NULL,\n \"institution_id\" \tvarchar(255) NULL,\n \"license\" \tvarchar(2048) NULL,\n \"modified\" \tdatetimeoffset(6) NULL,\n \"owner_institution_code\"\tvarchar(255) NULL,\n \"record_language\" \tvarchar(35) NULL,\n \"record_references\" \tvarchar(2048) NULL,\n \"record_type\" \tvarchar(32) NULL,\n \"rights_holder\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"image_set_upload_id\" \tbigint NULL,\n CONSTRAINT \"PK__darwin_c__3213E83F92DAE497\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"fathomnet_identities\" (\n \"id\" \tbigint NOT NULL,\n \"api_key\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"disabled\" \tbit NULL,\n \"display_name\" \tvarchar(255) NULL,\n \"email\" \tvarchar(255) NULL,\n \"expertise_rank\" \tvarchar(32) NULL,\n \"firebase_uid\" \tvarchar(255) NULL,\n \"job_title\" \tvarchar(255) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"organization\" \tvarchar(255) NULL,\n \"profile\" \tvarchar(1024) NULL,\n \"role_data\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"avatar_url\" \tvarchar(2000) NULL,\n \"orcid\" \tvarchar(32) NULL,\n \"notification_frequency\"\tvarchar(32) NULL,\n CONSTRAINT \"PK__fathomne__3213E83F59FE1468\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"fathomnet_identities_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"api_key\" \tvarchar(255) NULL,\n \"avatar_url\" \tvarchar(2000) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"disabled\" \tbit NULL,\n \"display_name\" \tvarchar(255) NULL,\n \"email\" \tvarchar(254) NULL,\n \"expertise_rank\" \tvarchar(32) NULL,\n \"firebase_uid\" \tvarchar(64) NULL,\n \"job_title\" \tvarchar(255) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"orcid\" \tvarchar(32) NULL,\n \"organization\" \tvarchar(255) NULL,\n \"profile\" \tvarchar(1024) NULL,\n \"role_data\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"notification_frequency\"\tvarchar(32) NULL,\n CONSTRAINT \"PK__fathomne__BE3894F9CD98EF78\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"followed_topics\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"email\" \tvarchar(254) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"notification\" \tbit NULL,\n \"target\" \tvarchar(256) NULL,\n \"topic\" \tvarchar(32) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n CONSTRAINT \"PK__followed__3213E83F4A1EA9E0\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"image_set_uploads\" (\n \"id\" \tbigint NOT NULL,\n \"contributors_email\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"format\" \tvarchar(255) NULL,\n \"last_updated_timestamp\" \tdatetime2(6) NULL,\n \"local_path\" \tvarchar(2048) NULL,\n \"rejection_details\" \tvarchar(255) NULL,\n \"rejection_reason\" \tvarchar(255) NULL,\n \"remote_uri\" \tvarchar(2048) NULL,\n \"sha256\" \tvarchar(64) NULL,\n \"status\" \tvarchar(255) NULL,\n \"status_update_timestamp\"\tdatetimeoffset(6) NULL,\n \"status_updater_email\" \tvarchar(254) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"darwincore_id\" \tbigint NULL,\n CONSTRAINT \"PK__image_se__3213E83F9C72A0E9\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"image_uploads_join\" (\n \"imagesetupload_id\"\tbigint NOT NULL,\n \"image_id\" \tbigint NOT NULL,\n CONSTRAINT \"PK__image_up__8A53EE0EBD9D776A\" PRIMARY KEY CLUSTERED(\"imagesetupload_id\",\"image_id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"images\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"depth_meters\" \tfloat NULL,\n \"height\" \tint NULL,\n \"imaging_type\" \tvarchar(64) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"last_validation\" \tdatetimeoffset(6) NULL,\n \"latitude\" \tfloat NULL,\n \"longitude\" \tfloat NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"modified\" \tdatetimeoffset(6) NULL,\n \"sha256\" \tvarchar(64) NULL,\n \"submitter\" \tvarchar(255) NULL,\n \"timestamp\" \tdatetimeoffset(6) NULL,\n \"url\" \tvarchar(2048) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"valid\" \tbit NULL,\n \"width\" \tint NULL,\n \"contributors_email\" \tvarchar(254) NULL,\n \"altitude\" \tfloat NULL,\n \"oxygen_ml_l\" \tfloat NULL,\n \"pressure_dbar\" \tfloat NULL,\n \"salinity\" \tfloat NULL,\n \"temperature_celsius\" \tfloat NULL,\n CONSTRAINT \"PK__images__3213E83FD76E309F\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"images_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"contributors_email\" \tvarchar(254) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"depth_meters\" \tfloat NULL,\n \"height\" \tint NULL,\n \"imaging_type\" \tvarchar(64) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"last_validation\" \tdatetimeoffset(6) NULL,\n \"latitude\" \tfloat NULL,\n \"longitude\" \tfloat NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"modified\" \tdatetimeoffset(6) NULL,\n \"sha256\" \tvarchar(64) NULL,\n \"timestamp\" \tdatetimeoffset(6) NULL,\n \"url\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"valid\" \tbit NULL,\n \"width\" \tint NULL,\n \"altitude\" \tfloat NULL,\n \"oxygen_ml_l\" \tfloat NULL,\n \"pressure_dbar\" \tfloat NULL,\n \"salinity\" \tfloat NULL,\n \"temperature_celsius\" \tfloat NULL,\n CONSTRAINT \"PK__images_a__BE3894F92DF6715C\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"marine_regions\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2 NULL,\n \"last_updated_timestamp\"\tdatetime2 NULL,\n \"max_latitude\" \tfloat NOT NULL,\n \"max_longitude\" \tfloat NOT NULL,\n \"min_latitude\" \tfloat NOT NULL,\n \"min_longitude\" \tfloat NOT NULL,\n \"mrgid\" \tbigint NULL,\n \"name\" \tvarchar(255) NULL,\n CONSTRAINT \"PK__marine_r__3213E83FE987FC8B\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"revinfo\" (\n \"rev\" \tint IDENTITY(1,1) NOT NULL,\n \"revtstmp\"\tbigint NULL,\n CONSTRAINT \"PK__revinfo__C2B7CC69D3938648\" PRIMARY KEY CLUSTERED(\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"tags\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2 NULL,\n \"tag\" \tvarchar(255) NOT NULL,\n \"last_updated_timestamp\"\tdatetime2 NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"value\" \tvarchar(255) NOT NULL,\n \"image_id\" \tbigint NULL,\n CONSTRAINT \"PK__tags__3213E83F3A490684\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"tags_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"created_timestamp\" \tdatetime2 NULL,\n \"tag\" \tvarchar(255) NULL,\n \"last_updated_timestamp\"\tdatetime2 NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"value\" \tvarchar(255) NULL,\n \"image_id\" \tbigint NULL,\n CONSTRAINT \"PK__tags_aud__BE3894F94F1608A8\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE VIEW \"dbo\".\"boundingbox_extended_info\" AS\n SELECT\n b.concept,\n b.alt_concept,\n b.observer,\n b.verified,\n b.verifier,\n b.verification_timestamp,\n b.user_defined_key,\n i.url,\n i.width,\n i.height,\n i.submitter,\n i.[timestamp],\n i.contributors_email AS image_contributors_email,\n u.contributors_email AS upload_contributors_email,\n dc.owner_institution_code,\n dc.institution_code,\n dc.rights_holder,\n dc.collection_code,\n dc.collection_id,\n dc.dataset_name\n FROM\n dbo.darwin_cores dc LEFT JOIN\n dbo.image_set_uploads u ON dc.id = u.darwincore_id LEFT JOIN\n dbo.image_uploads_join j ON j.imagesetupload_id = u.id LEFT JOIN\n dbo.images i ON j.image_id = i.id LEFT JOIN\n dbo.bounding_boxes b ON b.image_id = i.id\n ;\n\n First generate the observation from the prompt and how will you generate thq query, then only generate the prompt. Make sure the sql query is inside ```\n If the prompt is asking about species or images of individual species, draft the sql in such a way that it generates json array containing the species data. Species data must contain species concept and bounding box id as id.\n\n Prompt: Provide the data that correlates salinity levels with the distribution of Aurelia aurita"}, {"role": "assistant", "content": "Observation:The prompt asks to find correlation between salinity levels with the distribution of Aurelia aurita. Since the prompt does not provide the salinity levels, use the salinity level normally used to understand ocean water salinity level. So, use levels <32, 32-33, 33-34, 34-35, 35-36, 36-37, >37\nUse these region to find out, the distribution of the species in these regions. Also, make sure you include the 0 values, which will help user better understand that some region donot have the species.\n\nSql Query:```WITH SalinityLevels AS (\n SELECT '<32' AS salinity_level\n UNION ALL\n SELECT '32-33'\n UNION ALL\n SELECT '33-34'\n UNION ALL\n SELECT '34-35'\n UNION ALL\n SELECT '35-36'\n UNION ALL\n SELECT '36-37'\n UNION ALL\n SELECT '>37'\n),\nAggregatedData AS (\n SELECT \n CASE \n WHEN images.salinity < 32 THEN '<32'\n WHEN images.salinity BETWEEN 32 AND 33 THEN '32-33'\n WHEN images.salinity BETWEEN 33 AND 34 THEN '33-34'\n WHEN images.salinity BETWEEN 34 AND 35 THEN '34-35'\n WHEN images.salinity BETWEEN 35 AND 36 THEN '35-36'\n WHEN images.salinity BETWEEN 36 AND 37 THEN '36-37'\n WHEN images.salinity > 37 THEN '>37'\n END AS salinity_level,\n COUNT(bounding_boxes.concept) AS species_count\n FROM \n dbo.images\n JOIN \n dbo.bounding_boxes ON images.id = bounding_boxes.image_id\n WHERE \n bounding_boxes.concept = 'Aurelia aurita'\n AND \n images.salinity IS NOT NULL\n GROUP BY \n CASE \n WHEN images.salinity < 32 THEN '<32'\n WHEN images.salinity BETWEEN 32 AND 33 THEN '32-33'\n WHEN images.salinity BETWEEN 33 AND 34 THEN '33-34'\n WHEN images.salinity BETWEEN 34 AND 35 THEN '34-35'\n WHEN images.salinity BETWEEN 35 AND 36 THEN '35-36'\n WHEN images.salinity BETWEEN 36 AND 37 THEN '36-37'\n WHEN images.salinity > 37 THEN '>37'\n END\n)\nSELECT \n sl.salinity_level,\n COALESCE(ad.species_count, 0) AS species_count\nFROM \n SalinityLevels sl\nLEFT JOIN \n AggregatedData ad ON sl.salinity_level = ad.salinity_level\nORDER BY \n salinity_level;```"}]}
{"messages": [{"role": "system", "content": "You are a text-to-sql generator. You have a database of marine species. The sql should be generated in a way such that the response from sql is a json. "}, {"role": "user", "content": "\n The database has the following structure.\n\n CREATE TABLE \"dbo\".\"bounding_box_comments\" (\n \"id\" \tbigint NOT NULL,\n \"bounding_box_uuid\" \tuniqueidentifier NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"email\" \tvarchar(254) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"text\" \tvarchar(2048) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"alternate_concept\" \tvarchar(255) NULL,\n \"flagged\" \tbit NULL,\n CONSTRAINT \"PK__bounding__3213E83F71625CCD\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"bounding_boxes\" (\n \"id\" \tbigint NOT NULL,\n \"concept\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"group_of\" \tbit NULL,\n \"height\" \tint NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"observer\" \tvarchar(256) NULL,\n \"occluded\" \tbit NULL,\n \"truncated\" \tbit NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"verification_timestamp\"\tdatetimeoffset(6) NULL,\n \"verified\" \tbit NULL,\n \"verifier\" \tvarchar(256) NULL,\n \"width\" \tint NULL,\n \"x\" \tint NULL,\n \"y\" \tint NULL,\n \"image_id\" \tbigint NULL,\n \"alt_concept\" \tvarchar(255) NULL,\n \"user_defined_key\" \tvarchar(56) NULL,\n CONSTRAINT \"PK__bounding__3213E83F3E4C2D08\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"bounding_boxes_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"concept\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"group_of\" \tbit NULL,\n \"height\" \tint NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"observer\" \tvarchar(256) NULL,\n \"occluded\" \tbit NULL,\n \"truncated\" \tbit NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"verification_timestamp\"\tdatetimeoffset(6) NULL,\n \"verified\" \tbit NULL,\n \"verifier\" \tvarchar(256) NULL,\n \"width\" \tint NULL,\n \"x\" \tint NULL,\n \"y\" \tint NULL,\n \"image_id\" \tbigint NULL,\n \"alt_concept\" \tvarchar(255) NULL,\n \"user_defined_key\" \tvarchar(56) NULL,\n CONSTRAINT \"PK__bounding__BE3894F99D30F28A\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"darwin_cores\" (\n \"id\" \tbigint NOT NULL,\n \"access_rights\" \tvarchar(1024) NULL,\n \"basis_of_record\" \tvarchar(64) NULL,\n \"bibliographic_citation\"\tvarchar(512) NULL,\n \"collection_code\" \tvarchar(64) NULL,\n \"collection_id\" \tvarchar(2048) NULL,\n \"data_generalizations\" \tvarchar(512) NULL,\n \"dataset_id\" \tuniqueidentifier NULL,\n \"dataset_name\" \tvarchar(255) NULL,\n \"dynamic_properties\" \tvarchar(2048) NULL,\n \"information_withheld\" \tvarchar(255) NULL,\n \"institution_code\" \tvarchar(255) NULL,\n \"institution_id\" \tvarchar(255) NULL,\n \"license\" \tvarchar(2048) NULL,\n \"modified\" \tdatetimeoffset(6) NULL,\n \"owner_institution_code\"\tvarchar(255) NULL,\n \"record_language\" \tvarchar(35) NULL,\n \"record_references\" \tvarchar(2048) NULL,\n \"record_type\" \tvarchar(32) NULL,\n \"rights_holder\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"image_set_upload_id\" \tbigint NULL,\n CONSTRAINT \"PK__darwin_c__3213E83F92DAE497\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"fathomnet_identities\" (\n \"id\" \tbigint NOT NULL,\n \"api_key\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"disabled\" \tbit NULL,\n \"display_name\" \tvarchar(255) NULL,\n \"email\" \tvarchar(255) NULL,\n \"expertise_rank\" \tvarchar(32) NULL,\n \"firebase_uid\" \tvarchar(255) NULL,\n \"job_title\" \tvarchar(255) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"organization\" \tvarchar(255) NULL,\n \"profile\" \tvarchar(1024) NULL,\n \"role_data\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"avatar_url\" \tvarchar(2000) NULL,\n \"orcid\" \tvarchar(32) NULL,\n \"notification_frequency\"\tvarchar(32) NULL,\n CONSTRAINT \"PK__fathomne__3213E83F59FE1468\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"fathomnet_identities_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"api_key\" \tvarchar(255) NULL,\n \"avatar_url\" \tvarchar(2000) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"disabled\" \tbit NULL,\n \"display_name\" \tvarchar(255) NULL,\n \"email\" \tvarchar(254) NULL,\n \"expertise_rank\" \tvarchar(32) NULL,\n \"firebase_uid\" \tvarchar(64) NULL,\n \"job_title\" \tvarchar(255) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"orcid\" \tvarchar(32) NULL,\n \"organization\" \tvarchar(255) NULL,\n \"profile\" \tvarchar(1024) NULL,\n \"role_data\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"notification_frequency\"\tvarchar(32) NULL,\n CONSTRAINT \"PK__fathomne__BE3894F9CD98EF78\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"followed_topics\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"email\" \tvarchar(254) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"notification\" \tbit NULL,\n \"target\" \tvarchar(256) NULL,\n \"topic\" \tvarchar(32) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n CONSTRAINT \"PK__followed__3213E83F4A1EA9E0\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"image_set_uploads\" (\n \"id\" \tbigint NOT NULL,\n \"contributors_email\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"format\" \tvarchar(255) NULL,\n \"last_updated_timestamp\" \tdatetime2(6) NULL,\n \"local_path\" \tvarchar(2048) NULL,\n \"rejection_details\" \tvarchar(255) NULL,\n \"rejection_reason\" \tvarchar(255) NULL,\n \"remote_uri\" \tvarchar(2048) NULL,\n \"sha256\" \tvarchar(64) NULL,\n \"status\" \tvarchar(255) NULL,\n \"status_update_timestamp\"\tdatetimeoffset(6) NULL,\n \"status_updater_email\" \tvarchar(254) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"darwincore_id\" \tbigint NULL,\n CONSTRAINT \"PK__image_se__3213E83F9C72A0E9\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"image_uploads_join\" (\n \"imagesetupload_id\"\tbigint NOT NULL,\n \"image_id\" \tbigint NOT NULL,\n CONSTRAINT \"PK__image_up__8A53EE0EBD9D776A\" PRIMARY KEY CLUSTERED(\"imagesetupload_id\",\"image_id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"images\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"depth_meters\" \tfloat NULL,\n \"height\" \tint NULL,\n \"imaging_type\" \tvarchar(64) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"last_validation\" \tdatetimeoffset(6) NULL,\n \"latitude\" \tfloat NULL,\n \"longitude\" \tfloat NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"modified\" \tdatetimeoffset(6) NULL,\n \"sha256\" \tvarchar(64) NULL,\n \"submitter\" \tvarchar(255) NULL,\n \"timestamp\" \tdatetimeoffset(6) NULL,\n \"url\" \tvarchar(2048) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"valid\" \tbit NULL,\n \"width\" \tint NULL,\n \"contributors_email\" \tvarchar(254) NULL,\n \"altitude\" \tfloat NULL,\n \"oxygen_ml_l\" \tfloat NULL,\n \"pressure_dbar\" \tfloat NULL,\n \"salinity\" \tfloat NULL,\n \"temperature_celsius\" \tfloat NULL,\n CONSTRAINT \"PK__images__3213E83FD76E309F\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"images_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"contributors_email\" \tvarchar(254) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"depth_meters\" \tfloat NULL,\n \"height\" \tint NULL,\n \"imaging_type\" \tvarchar(64) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"last_validation\" \tdatetimeoffset(6) NULL,\n \"latitude\" \tfloat NULL,\n \"longitude\" \tfloat NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"modified\" \tdatetimeoffset(6) NULL,\n \"sha256\" \tvarchar(64) NULL,\n \"timestamp\" \tdatetimeoffset(6) NULL,\n \"url\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"valid\" \tbit NULL,\n \"width\" \tint NULL,\n \"altitude\" \tfloat NULL,\n \"oxygen_ml_l\" \tfloat NULL,\n \"pressure_dbar\" \tfloat NULL,\n \"salinity\" \tfloat NULL,\n \"temperature_celsius\" \tfloat NULL,\n CONSTRAINT \"PK__images_a__BE3894F92DF6715C\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"marine_regions\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2 NULL,\n \"last_updated_timestamp\"\tdatetime2 NULL,\n \"max_latitude\" \tfloat NOT NULL,\n \"max_longitude\" \tfloat NOT NULL,\n \"min_latitude\" \tfloat NOT NULL,\n \"min_longitude\" \tfloat NOT NULL,\n \"mrgid\" \tbigint NULL,\n \"name\" \tvarchar(255) NULL,\n CONSTRAINT \"PK__marine_r__3213E83FE987FC8B\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"revinfo\" (\n \"rev\" \tint IDENTITY(1,1) NOT NULL,\n \"revtstmp\"\tbigint NULL,\n CONSTRAINT \"PK__revinfo__C2B7CC69D3938648\" PRIMARY KEY CLUSTERED(\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"tags\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2 NULL,\n \"tag\" \tvarchar(255) NOT NULL,\n \"last_updated_timestamp\"\tdatetime2 NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"value\" \tvarchar(255) NOT NULL,\n \"image_id\" \tbigint NULL,\n CONSTRAINT \"PK__tags__3213E83F3A490684\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"tags_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"created_timestamp\" \tdatetime2 NULL,\n \"tag\" \tvarchar(255) NULL,\n \"last_updated_timestamp\"\tdatetime2 NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"value\" \tvarchar(255) NULL,\n \"image_id\" \tbigint NULL,\n CONSTRAINT \"PK__tags_aud__BE3894F94F1608A8\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE VIEW \"dbo\".\"boundingbox_extended_info\" AS\n SELECT\n b.concept,\n b.alt_concept,\n b.observer,\n b.verified,\n b.verifier,\n b.verification_timestamp,\n b.user_defined_key,\n i.url,\n i.width,\n i.height,\n i.submitter,\n i.[timestamp],\n i.contributors_email AS image_contributors_email,\n u.contributors_email AS upload_contributors_email,\n dc.owner_institution_code,\n dc.institution_code,\n dc.rights_holder,\n dc.collection_code,\n dc.collection_id,\n dc.dataset_name\n FROM\n dbo.darwin_cores dc LEFT JOIN\n dbo.image_set_uploads u ON dc.id = u.darwincore_id LEFT JOIN\n dbo.image_uploads_join j ON j.imagesetupload_id = u.id LEFT JOIN\n dbo.images i ON j.image_id = i.id LEFT JOIN\n dbo.bounding_boxes b ON b.image_id = i.id\n ;\n\n First generate the observation from the prompt and how will you generate thq query, then only generate the prompt. Make sure the sql query is inside ```\n If the prompt is asking about species or images of individual species, draft the sql in such a way that it generates json array containing the species data. Species data must contain species concept and bounding box id as id.\n\n Prompt: Provide the data that correlates depth with the distribution of Aurelia aurita\n"}, {"role": "assistant", "content": "Observation:The prompt asks the correlation between depth with the distribution of Aurelia aurita. Since you are asked about depth, without providing the level of depths, it is better to use normal ocean depth levels like Epipelagic (0-200m), Mesopelagic (200-1000m), Bathypelagic (1000-4000m), Abyssopelagic (4000-6000m) and Hadalpelagic (>6000m).\nUse these region to find out, the number of the species in these regions. Also, make sure you include the 0 values, which will help user better understand that some region donot have the species.\n\nSql Query:```WITH DepthLevels AS (\n SELECT 'Epipelagic (0-200m)' AS depth_level, 0 AS min_depth, 200 AS max_depth\n UNION ALL\n SELECT 'Mesopelagic (200-1000m)', 200, 1000\n UNION ALL\n SELECT 'Bathypelagic (1000-4000m)', 1000, 4000\n UNION ALL\n SELECT 'Abyssopelagic (4000-6000m)', 4000, 6000\n UNION ALL\n SELECT 'Hadalpelagic (>6000m)', 6001, 1000000 -- assuming a large max value to capture everything > 6000\n),\nAggregatedData AS (\n SELECT \n CASE \n WHEN images.depth_meters BETWEEN 0 AND 200 THEN 'Epipelagic (0-200m)'\n WHEN images.depth_meters BETWEEN 200 AND 1000 THEN 'Mesopelagic (200-1000m)'\n WHEN images.depth_meters BETWEEN 1000 AND 4000 THEN 'Bathypelagic (1000-4000m)'\n WHEN images.depth_meters BETWEEN 4000 AND 6000 THEN 'Abyssopelagic (4000-6000m)'\n WHEN images.depth_meters > 6000 THEN 'Hadalpelagic (>6000m)'\n END AS depth_level,\n COUNT(bounding_boxes.id) AS distribution\n FROM \n images \n JOIN \n bounding_boxes \n ON \n images.id = bounding_boxes.image_id\n WHERE \n bounding_boxes.concept = 'Aurelia aurita'\n AND \n images.depth_meters IS NOT NULL\n GROUP BY \n CASE \n WHEN images.depth_meters BETWEEN 0 AND 200 THEN 'Epipelagic (0-200m)'\n WHEN images.depth_meters BETWEEN 200 AND 1000 THEN 'Mesopelagic (200-1000m)'\n WHEN images.depth_meters BETWEEN 1000 AND 4000 THEN 'Bathypelagic (1000-4000m)'\n WHEN images.depth_meters BETWEEN 4000 AND 6000 THEN 'Abyssopelagic (4000-6000m)'\n WHEN images.depth_meters > 6000 THEN 'Hadalpelagic (>6000m)'\n END\n)\nSELECT \n dl.depth_level, \n COALESCE(ad.distribution, 0) AS distribution\nFROM \n DepthLevels dl\nLEFT JOIN \n AggregatedData ad ON dl.depth_level = ad.depth_level\nORDER BY \n dl.min_depth;```"}]}
{"messages": [{"role": "system", "content": "You are a text-to-sql generator. You have a database of marine species. The sql should be generated in a way such that the response from sql is a json. "}, {"role": "user", "content": "\n The database has the following structure.\n\n CREATE TABLE \"dbo\".\"bounding_box_comments\" (\n \"id\" \tbigint NOT NULL,\n \"bounding_box_uuid\" \tuniqueidentifier NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"email\" \tvarchar(254) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"text\" \tvarchar(2048) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"alternate_concept\" \tvarchar(255) NULL,\n \"flagged\" \tbit NULL,\n CONSTRAINT \"PK__bounding__3213E83F71625CCD\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"bounding_boxes\" (\n \"id\" \tbigint NOT NULL,\n \"concept\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"group_of\" \tbit NULL,\n \"height\" \tint NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"observer\" \tvarchar(256) NULL,\n \"occluded\" \tbit NULL,\n \"truncated\" \tbit NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"verification_timestamp\"\tdatetimeoffset(6) NULL,\n \"verified\" \tbit NULL,\n \"verifier\" \tvarchar(256) NULL,\n \"width\" \tint NULL,\n \"x\" \tint NULL,\n \"y\" \tint NULL,\n \"image_id\" \tbigint NULL,\n \"alt_concept\" \tvarchar(255) NULL,\n \"user_defined_key\" \tvarchar(56) NULL,\n CONSTRAINT \"PK__bounding__3213E83F3E4C2D08\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"bounding_boxes_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"concept\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"group_of\" \tbit NULL,\n \"height\" \tint NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"observer\" \tvarchar(256) NULL,\n \"occluded\" \tbit NULL,\n \"truncated\" \tbit NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"verification_timestamp\"\tdatetimeoffset(6) NULL,\n \"verified\" \tbit NULL,\n \"verifier\" \tvarchar(256) NULL,\n \"width\" \tint NULL,\n \"x\" \tint NULL,\n \"y\" \tint NULL,\n \"image_id\" \tbigint NULL,\n \"alt_concept\" \tvarchar(255) NULL,\n \"user_defined_key\" \tvarchar(56) NULL,\n CONSTRAINT \"PK__bounding__BE3894F99D30F28A\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"darwin_cores\" (\n \"id\" \tbigint NOT NULL,\n \"access_rights\" \tvarchar(1024) NULL,\n \"basis_of_record\" \tvarchar(64) NULL,\n \"bibliographic_citation\"\tvarchar(512) NULL,\n \"collection_code\" \tvarchar(64) NULL,\n \"collection_id\" \tvarchar(2048) NULL,\n \"data_generalizations\" \tvarchar(512) NULL,\n \"dataset_id\" \tuniqueidentifier NULL,\n \"dataset_name\" \tvarchar(255) NULL,\n \"dynamic_properties\" \tvarchar(2048) NULL,\n \"information_withheld\" \tvarchar(255) NULL,\n \"institution_code\" \tvarchar(255) NULL,\n \"institution_id\" \tvarchar(255) NULL,\n \"license\" \tvarchar(2048) NULL,\n \"modified\" \tdatetimeoffset(6) NULL,\n \"owner_institution_code\"\tvarchar(255) NULL,\n \"record_language\" \tvarchar(35) NULL,\n \"record_references\" \tvarchar(2048) NULL,\n \"record_type\" \tvarchar(32) NULL,\n \"rights_holder\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"image_set_upload_id\" \tbigint NULL,\n CONSTRAINT \"PK__darwin_c__3213E83F92DAE497\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"fathomnet_identities\" (\n \"id\" \tbigint NOT NULL,\n \"api_key\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"disabled\" \tbit NULL,\n \"display_name\" \tvarchar(255) NULL,\n \"email\" \tvarchar(255) NULL,\n \"expertise_rank\" \tvarchar(32) NULL,\n \"firebase_uid\" \tvarchar(255) NULL,\n \"job_title\" \tvarchar(255) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"organization\" \tvarchar(255) NULL,\n \"profile\" \tvarchar(1024) NULL,\n \"role_data\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"avatar_url\" \tvarchar(2000) NULL,\n \"orcid\" \tvarchar(32) NULL,\n \"notification_frequency\"\tvarchar(32) NULL,\n CONSTRAINT \"PK__fathomne__3213E83F59FE1468\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"fathomnet_identities_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"api_key\" \tvarchar(255) NULL,\n \"avatar_url\" \tvarchar(2000) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"disabled\" \tbit NULL,\n \"display_name\" \tvarchar(255) NULL,\n \"email\" \tvarchar(254) NULL,\n \"expertise_rank\" \tvarchar(32) NULL,\n \"firebase_uid\" \tvarchar(64) NULL,\n \"job_title\" \tvarchar(255) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"orcid\" \tvarchar(32) NULL,\n \"organization\" \tvarchar(255) NULL,\n \"profile\" \tvarchar(1024) NULL,\n \"role_data\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"notification_frequency\"\tvarchar(32) NULL,\n CONSTRAINT \"PK__fathomne__BE3894F9CD98EF78\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"followed_topics\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"email\" \tvarchar(254) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"notification\" \tbit NULL,\n \"target\" \tvarchar(256) NULL,\n \"topic\" \tvarchar(32) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n CONSTRAINT \"PK__followed__3213E83F4A1EA9E0\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"image_set_uploads\" (\n \"id\" \tbigint NOT NULL,\n \"contributors_email\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"format\" \tvarchar(255) NULL,\n \"last_updated_timestamp\" \tdatetime2(6) NULL,\n \"local_path\" \tvarchar(2048) NULL,\n \"rejection_details\" \tvarchar(255) NULL,\n \"rejection_reason\" \tvarchar(255) NULL,\n \"remote_uri\" \tvarchar(2048) NULL,\n \"sha256\" \tvarchar(64) NULL,\n \"status\" \tvarchar(255) NULL,\n \"status_update_timestamp\"\tdatetimeoffset(6) NULL,\n \"status_updater_email\" \tvarchar(254) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"darwincore_id\" \tbigint NULL,\n CONSTRAINT \"PK__image_se__3213E83F9C72A0E9\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"image_uploads_join\" (\n \"imagesetupload_id\"\tbigint NOT NULL,\n \"image_id\" \tbigint NOT NULL,\n CONSTRAINT \"PK__image_up__8A53EE0EBD9D776A\" PRIMARY KEY CLUSTERED(\"imagesetupload_id\",\"image_id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"images\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"depth_meters\" \tfloat NULL,\n \"height\" \tint NULL,\n \"imaging_type\" \tvarchar(64) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"last_validation\" \tdatetimeoffset(6) NULL,\n \"latitude\" \tfloat NULL,\n \"longitude\" \tfloat NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"modified\" \tdatetimeoffset(6) NULL,\n \"sha256\" \tvarchar(64) NULL,\n \"submitter\" \tvarchar(255) NULL,\n \"timestamp\" \tdatetimeoffset(6) NULL,\n \"url\" \tvarchar(2048) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"valid\" \tbit NULL,\n \"width\" \tint NULL,\n \"contributors_email\" \tvarchar(254) NULL,\n \"altitude\" \tfloat NULL,\n \"oxygen_ml_l\" \tfloat NULL,\n \"pressure_dbar\" \tfloat NULL,\n \"salinity\" \tfloat NULL,\n \"temperature_celsius\" \tfloat NULL,\n CONSTRAINT \"PK__images__3213E83FD76E309F\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"images_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"contributors_email\" \tvarchar(254) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"depth_meters\" \tfloat NULL,\n \"height\" \tint NULL,\n \"imaging_type\" \tvarchar(64) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"last_validation\" \tdatetimeoffset(6) NULL,\n \"latitude\" \tfloat NULL,\n \"longitude\" \tfloat NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"modified\" \tdatetimeoffset(6) NULL,\n \"sha256\" \tvarchar(64) NULL,\n \"timestamp\" \tdatetimeoffset(6) NULL,\n \"url\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"valid\" \tbit NULL,\n \"width\" \tint NULL,\n \"altitude\" \tfloat NULL,\n \"oxygen_ml_l\" \tfloat NULL,\n \"pressure_dbar\" \tfloat NULL,\n \"salinity\" \tfloat NULL,\n \"temperature_celsius\" \tfloat NULL,\n CONSTRAINT \"PK__images_a__BE3894F92DF6715C\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"marine_regions\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2 NULL,\n \"last_updated_timestamp\"\tdatetime2 NULL,\n \"max_latitude\" \tfloat NOT NULL,\n \"max_longitude\" \tfloat NOT NULL,\n \"min_latitude\" \tfloat NOT NULL,\n \"min_longitude\" \tfloat NOT NULL,\n \"mrgid\" \tbigint NULL,\n \"name\" \tvarchar(255) NULL,\n CONSTRAINT \"PK__marine_r__3213E83FE987FC8B\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"revinfo\" (\n \"rev\" \tint IDENTITY(1,1) NOT NULL,\n \"revtstmp\"\tbigint NULL,\n CONSTRAINT \"PK__revinfo__C2B7CC69D3938648\" PRIMARY KEY CLUSTERED(\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"tags\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2 NULL,\n \"tag\" \tvarchar(255) NOT NULL,\n \"last_updated_timestamp\"\tdatetime2 NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"value\" \tvarchar(255) NOT NULL,\n \"image_id\" \tbigint NULL,\n CONSTRAINT \"PK__tags__3213E83F3A490684\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"tags_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"created_timestamp\" \tdatetime2 NULL,\n \"tag\" \tvarchar(255) NULL,\n \"last_updated_timestamp\"\tdatetime2 NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"value\" \tvarchar(255) NULL,\n \"image_id\" \tbigint NULL,\n CONSTRAINT \"PK__tags_aud__BE3894F94F1608A8\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE VIEW \"dbo\".\"boundingbox_extended_info\" AS\n SELECT\n b.concept,\n b.alt_concept,\n b.observer,\n b.verified,\n b.verifier,\n b.verification_timestamp,\n b.user_defined_key,\n i.url,\n i.width,\n i.height,\n i.submitter,\n i.[timestamp],\n i.contributors_email AS image_contributors_email,\n u.contributors_email AS upload_contributors_email,\n dc.owner_institution_code,\n dc.institution_code,\n dc.rights_holder,\n dc.collection_code,\n dc.collection_id,\n dc.dataset_name\n FROM\n dbo.darwin_cores dc LEFT JOIN\n dbo.image_set_uploads u ON dc.id = u.darwincore_id LEFT JOIN\n dbo.image_uploads_join j ON j.imagesetupload_id = u.id LEFT JOIN\n dbo.images i ON j.image_id = i.id LEFT JOIN\n dbo.bounding_boxes b ON b.image_id = i.id\n ;\n\n First generate the observation from the prompt and how will you generate thq query, then only generate the prompt. Make sure the sql query is inside ```\n If the prompt is asking about species or images of individual species, draft the sql in such a way that it generates json array containing the species data. Species data must contain species concept and bounding box id as id.\n\n Prompt: Find place that has the highest temperature and species that is found the most at that place\n"}, {"role": "assistant", "content": "Observation:You need to find the detail of specific species from the database. So you need to format the output such that it is a json and has species array that has species concept as concept and species bounding box id as id\nThe prompt has two section, first is to find the place that has the highest temperature. Since the prompt does not talk about how we should define a place, you should use the regions table and its minimum latitude/longitude. To find maximum temperature in a particular region, we should take the average of all temperature in images data in that region\nOnce the region with highest temperature is found out, now you should use the region minimum latitude, minimum longitude, maximum latitude, maximum longitude data to find the most found species in the region. \nAfter the species data is found, you need to generate output data in the json format and should have species concept as concept and species bounding box id as id. Also since the prompt is asking about maximum temperature and species count, add maximum temperature and species count in the response\n\nSql Query:```WITH RegionAvgTemp AS (\n SELECT \n r.name as region_name,\n AVG(i.temperature_celsius) as avg_temperature\n FROM dbo.images i\n JOIN dbo.marine_regions r ON \n i.latitude BETWEEN r.min_latitude AND r.max_latitude AND\n i.longitude BETWEEN r.min_longitude AND r.max_longitude\n GROUP BY r.name\n),\nMaxTempRegion AS (\n SELECT TOP 1 region_name, avg_temperature\n FROM RegionAvgTemp\n ORDER BY avg_temperature ASC\n),\nMostFoundSpecies AS (\n SELECT \n b.concept, \n COUNT(*) as count\n FROM dbo.bounding_boxes b\n JOIN dbo.images i ON b.image_id = i.id\n JOIN dbo.marine_regions r ON \n i.latitude BETWEEN r.min_latitude AND r.max_latitude AND\n i.longitude BETWEEN r.min_longitude AND r.max_longitude\n JOIN MaxTempRegion m ON r.name = m.region_name\n GROUP BY b.concept\n)\nSELECT TOP 1 bb.id, mfs.concept, mfs.count, mtr.avg_temperature, mtr.region_name\nFROM MostFoundSpecies mfs\nJOIN dbo.bounding_boxes bb ON bb.concept = mfs.concept\nJOIN MaxTempRegion mtr ON 1=1\nORDER BY mfs.count ASC\nFOR JSON PATH;```"}]}
{"messages": [{"role": "system", "content": "You are a text-to-sql generator. You have a database of marine species. The sql should be generated in a way such that the response from sql is a json. "}, {"role": "user", "content": "\n The database has the following structure.\n\n CREATE TABLE \"dbo\".\"bounding_box_comments\" (\n \"id\" \tbigint NOT NULL,\n \"bounding_box_uuid\" \tuniqueidentifier NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"email\" \tvarchar(254) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"text\" \tvarchar(2048) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"alternate_concept\" \tvarchar(255) NULL,\n \"flagged\" \tbit NULL,\n CONSTRAINT \"PK__bounding__3213E83F71625CCD\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"bounding_boxes\" (\n \"id\" \tbigint NOT NULL,\n \"concept\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"group_of\" \tbit NULL,\n \"height\" \tint NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"observer\" \tvarchar(256) NULL,\n \"occluded\" \tbit NULL,\n \"truncated\" \tbit NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"verification_timestamp\"\tdatetimeoffset(6) NULL,\n \"verified\" \tbit NULL,\n \"verifier\" \tvarchar(256) NULL,\n \"width\" \tint NULL,\n \"x\" \tint NULL,\n \"y\" \tint NULL,\n \"image_id\" \tbigint NULL,\n \"alt_concept\" \tvarchar(255) NULL,\n \"user_defined_key\" \tvarchar(56) NULL,\n CONSTRAINT \"PK__bounding__3213E83F3E4C2D08\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"bounding_boxes_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"concept\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"group_of\" \tbit NULL,\n \"height\" \tint NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"observer\" \tvarchar(256) NULL,\n \"occluded\" \tbit NULL,\n \"truncated\" \tbit NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"verification_timestamp\"\tdatetimeoffset(6) NULL,\n \"verified\" \tbit NULL,\n \"verifier\" \tvarchar(256) NULL,\n \"width\" \tint NULL,\n \"x\" \tint NULL,\n \"y\" \tint NULL,\n \"image_id\" \tbigint NULL,\n \"alt_concept\" \tvarchar(255) NULL,\n \"user_defined_key\" \tvarchar(56) NULL,\n CONSTRAINT \"PK__bounding__BE3894F99D30F28A\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"darwin_cores\" (\n \"id\" \tbigint NOT NULL,\n \"access_rights\" \tvarchar(1024) NULL,\n \"basis_of_record\" \tvarchar(64) NULL,\n \"bibliographic_citation\"\tvarchar(512) NULL,\n \"collection_code\" \tvarchar(64) NULL,\n \"collection_id\" \tvarchar(2048) NULL,\n \"data_generalizations\" \tvarchar(512) NULL,\n \"dataset_id\" \tuniqueidentifier NULL,\n \"dataset_name\" \tvarchar(255) NULL,\n \"dynamic_properties\" \tvarchar(2048) NULL,\n \"information_withheld\" \tvarchar(255) NULL,\n \"institution_code\" \tvarchar(255) NULL,\n \"institution_id\" \tvarchar(255) NULL,\n \"license\" \tvarchar(2048) NULL,\n \"modified\" \tdatetimeoffset(6) NULL,\n \"owner_institution_code\"\tvarchar(255) NULL,\n \"record_language\" \tvarchar(35) NULL,\n \"record_references\" \tvarchar(2048) NULL,\n \"record_type\" \tvarchar(32) NULL,\n \"rights_holder\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"image_set_upload_id\" \tbigint NULL,\n CONSTRAINT \"PK__darwin_c__3213E83F92DAE497\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"fathomnet_identities\" (\n \"id\" \tbigint NOT NULL,\n \"api_key\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"disabled\" \tbit NULL,\n \"display_name\" \tvarchar(255) NULL,\n \"email\" \tvarchar(255) NULL,\n \"expertise_rank\" \tvarchar(32) NULL,\n \"firebase_uid\" \tvarchar(255) NULL,\n \"job_title\" \tvarchar(255) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"organization\" \tvarchar(255) NULL,\n \"profile\" \tvarchar(1024) NULL,\n \"role_data\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"avatar_url\" \tvarchar(2000) NULL,\n \"orcid\" \tvarchar(32) NULL,\n \"notification_frequency\"\tvarchar(32) NULL,\n CONSTRAINT \"PK__fathomne__3213E83F59FE1468\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"fathomnet_identities_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"api_key\" \tvarchar(255) NULL,\n \"avatar_url\" \tvarchar(2000) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"disabled\" \tbit NULL,\n \"display_name\" \tvarchar(255) NULL,\n \"email\" \tvarchar(254) NULL,\n \"expertise_rank\" \tvarchar(32) NULL,\n \"firebase_uid\" \tvarchar(64) NULL,\n \"job_title\" \tvarchar(255) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"orcid\" \tvarchar(32) NULL,\n \"organization\" \tvarchar(255) NULL,\n \"profile\" \tvarchar(1024) NULL,\n \"role_data\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"notification_frequency\"\tvarchar(32) NULL,\n CONSTRAINT \"PK__fathomne__BE3894F9CD98EF78\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"followed_topics\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"email\" \tvarchar(254) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"notification\" \tbit NULL,\n \"target\" \tvarchar(256) NULL,\n \"topic\" \tvarchar(32) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n CONSTRAINT \"PK__followed__3213E83F4A1EA9E0\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"image_set_uploads\" (\n \"id\" \tbigint NOT NULL,\n \"contributors_email\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"format\" \tvarchar(255) NULL,\n \"last_updated_timestamp\" \tdatetime2(6) NULL,\n \"local_path\" \tvarchar(2048) NULL,\n \"rejection_details\" \tvarchar(255) NULL,\n \"rejection_reason\" \tvarchar(255) NULL,\n \"remote_uri\" \tvarchar(2048) NULL,\n \"sha256\" \tvarchar(64) NULL,\n \"status\" \tvarchar(255) NULL,\n \"status_update_timestamp\"\tdatetimeoffset(6) NULL,\n \"status_updater_email\" \tvarchar(254) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"darwincore_id\" \tbigint NULL,\n CONSTRAINT \"PK__image_se__3213E83F9C72A0E9\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"image_uploads_join\" (\n \"imagesetupload_id\"\tbigint NOT NULL,\n \"image_id\" \tbigint NOT NULL,\n CONSTRAINT \"PK__image_up__8A53EE0EBD9D776A\" PRIMARY KEY CLUSTERED(\"imagesetupload_id\",\"image_id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"images\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"depth_meters\" \tfloat NULL,\n \"height\" \tint NULL,\n \"imaging_type\" \tvarchar(64) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"last_validation\" \tdatetimeoffset(6) NULL,\n \"latitude\" \tfloat NULL,\n \"longitude\" \tfloat NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"modified\" \tdatetimeoffset(6) NULL,\n \"sha256\" \tvarchar(64) NULL,\n \"submitter\" \tvarchar(255) NULL,\n \"timestamp\" \tdatetimeoffset(6) NULL,\n \"url\" \tvarchar(2048) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"valid\" \tbit NULL,\n \"width\" \tint NULL,\n \"contributors_email\" \tvarchar(254) NULL,\n \"altitude\" \tfloat NULL,\n \"oxygen_ml_l\" \tfloat NULL,\n \"pressure_dbar\" \tfloat NULL,\n \"salinity\" \tfloat NULL,\n \"temperature_celsius\" \tfloat NULL,\n CONSTRAINT \"PK__images__3213E83FD76E309F\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"images_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"contributors_email\" \tvarchar(254) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"depth_meters\" \tfloat NULL,\n \"height\" \tint NULL,\n \"imaging_type\" \tvarchar(64) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"last_validation\" \tdatetimeoffset(6) NULL,\n \"latitude\" \tfloat NULL,\n \"longitude\" \tfloat NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"modified\" \tdatetimeoffset(6) NULL,\n \"sha256\" \tvarchar(64) NULL,\n \"timestamp\" \tdatetimeoffset(6) NULL,\n \"url\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"valid\" \tbit NULL,\n \"width\" \tint NULL,\n \"altitude\" \tfloat NULL,\n \"oxygen_ml_l\" \tfloat NULL,\n \"pressure_dbar\" \tfloat NULL,\n \"salinity\" \tfloat NULL,\n \"temperature_celsius\" \tfloat NULL,\n CONSTRAINT \"PK__images_a__BE3894F92DF6715C\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"marine_regions\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2 NULL,\n \"last_updated_timestamp\"\tdatetime2 NULL,\n \"max_latitude\" \tfloat NOT NULL,\n \"max_longitude\" \tfloat NOT NULL,\n \"min_latitude\" \tfloat NOT NULL,\n \"min_longitude\" \tfloat NOT NULL,\n \"mrgid\" \tbigint NULL,\n \"name\" \tvarchar(255) NULL,\n CONSTRAINT \"PK__marine_r__3213E83FE987FC8B\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"revinfo\" (\n \"rev\" \tint IDENTITY(1,1) NOT NULL,\n \"revtstmp\"\tbigint NULL,\n CONSTRAINT \"PK__revinfo__C2B7CC69D3938648\" PRIMARY KEY CLUSTERED(\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"tags\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2 NULL,\n \"tag\" \tvarchar(255) NOT NULL,\n \"last_updated_timestamp\"\tdatetime2 NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"value\" \tvarchar(255) NOT NULL,\n \"image_id\" \tbigint NULL,\n CONSTRAINT \"PK__tags__3213E83F3A490684\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"tags_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"created_timestamp\" \tdatetime2 NULL,\n \"tag\" \tvarchar(255) NULL,\n \"last_updated_timestamp\"\tdatetime2 NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"value\" \tvarchar(255) NULL,\n \"image_id\" \tbigint NULL,\n CONSTRAINT \"PK__tags_aud__BE3894F94F1608A8\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE VIEW \"dbo\".\"boundingbox_extended_info\" AS\n SELECT\n b.concept,\n b.alt_concept,\n b.observer,\n b.verified,\n b.verifier,\n b.verification_timestamp,\n b.user_defined_key,\n i.url,\n i.width,\n i.height,\n i.submitter,\n i.[timestamp],\n i.contributors_email AS image_contributors_email,\n u.contributors_email AS upload_contributors_email,\n dc.owner_institution_code,\n dc.institution_code,\n dc.rights_holder,\n dc.collection_code,\n dc.collection_id,\n dc.dataset_name\n FROM\n dbo.darwin_cores dc LEFT JOIN\n dbo.image_set_uploads u ON dc.id = u.darwincore_id LEFT JOIN\n dbo.image_uploads_join j ON j.imagesetupload_id = u.id LEFT JOIN\n dbo.images i ON j.image_id = i.id LEFT JOIN\n dbo.bounding_boxes b ON b.image_id = i.id\n ;\n\n First generate the observation from the prompt and how will you generate thq query, then only generate the prompt. Make sure the sql query is inside ```\n If the prompt is asking about species or images of individual species, draft the sql in such a way that it generates json array containing the species data. Species data must contain species concept and bounding box id as id.\n\n Prompt: Find the species that are found in image with id 2256720\n"}, {"role": "assistant", "content": "Observation:You need to find the detail of specific species in an image from the database. So you need to format the output such that it is a json and has species array that has species concept as concept, image url as url, image id as image_id and species bounding box id as id\nSo, you need to search image table and bounding_boxes table using image id 2256720\nSql Query:```SELECT b.concept, b.id, i.id as image_id, i.url as url\nFROM dbo.bounding_boxes AS b\nJOIN dbo.images AS i ON b.image_id = i.id\nWHERE b.image_id = 2256720\nFOR JSON PATH;```"}]}
{"messages": [{"role": "system", "content": "You are a text-to-sql generator. You have a database of marine species. The sql should be generated in a way such that the response from sql is a json. "}, {"role": "user", "content": "\n The database has the following structure.\n\n CREATE TABLE \"dbo\".\"bounding_box_comments\" (\n \"id\" \tbigint NOT NULL,\n \"bounding_box_uuid\" \tuniqueidentifier NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"email\" \tvarchar(254) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"text\" \tvarchar(2048) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"alternate_concept\" \tvarchar(255) NULL,\n \"flagged\" \tbit NULL,\n CONSTRAINT \"PK__bounding__3213E83F71625CCD\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"bounding_boxes\" (\n \"id\" \tbigint NOT NULL,\n \"concept\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"group_of\" \tbit NULL,\n \"height\" \tint NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"observer\" \tvarchar(256) NULL,\n \"occluded\" \tbit NULL,\n \"truncated\" \tbit NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"verification_timestamp\"\tdatetimeoffset(6) NULL,\n \"verified\" \tbit NULL,\n \"verifier\" \tvarchar(256) NULL,\n \"width\" \tint NULL,\n \"x\" \tint NULL,\n \"y\" \tint NULL,\n \"image_id\" \tbigint NULL,\n \"alt_concept\" \tvarchar(255) NULL,\n \"user_defined_key\" \tvarchar(56) NULL,\n CONSTRAINT \"PK__bounding__3213E83F3E4C2D08\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"bounding_boxes_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"concept\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"group_of\" \tbit NULL,\n \"height\" \tint NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"observer\" \tvarchar(256) NULL,\n \"occluded\" \tbit NULL,\n \"truncated\" \tbit NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"verification_timestamp\"\tdatetimeoffset(6) NULL,\n \"verified\" \tbit NULL,\n \"verifier\" \tvarchar(256) NULL,\n \"width\" \tint NULL,\n \"x\" \tint NULL,\n \"y\" \tint NULL,\n \"image_id\" \tbigint NULL,\n \"alt_concept\" \tvarchar(255) NULL,\n \"user_defined_key\" \tvarchar(56) NULL,\n CONSTRAINT \"PK__bounding__BE3894F99D30F28A\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"darwin_cores\" (\n \"id\" \tbigint NOT NULL,\n \"access_rights\" \tvarchar(1024) NULL,\n \"basis_of_record\" \tvarchar(64) NULL,\n \"bibliographic_citation\"\tvarchar(512) NULL,\n \"collection_code\" \tvarchar(64) NULL,\n \"collection_id\" \tvarchar(2048) NULL,\n \"data_generalizations\" \tvarchar(512) NULL,\n \"dataset_id\" \tuniqueidentifier NULL,\n \"dataset_name\" \tvarchar(255) NULL,\n \"dynamic_properties\" \tvarchar(2048) NULL,\n \"information_withheld\" \tvarchar(255) NULL,\n \"institution_code\" \tvarchar(255) NULL,\n \"institution_id\" \tvarchar(255) NULL,\n \"license\" \tvarchar(2048) NULL,\n \"modified\" \tdatetimeoffset(6) NULL,\n \"owner_institution_code\"\tvarchar(255) NULL,\n \"record_language\" \tvarchar(35) NULL,\n \"record_references\" \tvarchar(2048) NULL,\n \"record_type\" \tvarchar(32) NULL,\n \"rights_holder\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"image_set_upload_id\" \tbigint NULL,\n CONSTRAINT \"PK__darwin_c__3213E83F92DAE497\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"fathomnet_identities\" (\n \"id\" \tbigint NOT NULL,\n \"api_key\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"disabled\" \tbit NULL,\n \"display_name\" \tvarchar(255) NULL,\n \"email\" \tvarchar(255) NULL,\n \"expertise_rank\" \tvarchar(32) NULL,\n \"firebase_uid\" \tvarchar(255) NULL,\n \"job_title\" \tvarchar(255) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"organization\" \tvarchar(255) NULL,\n \"profile\" \tvarchar(1024) NULL,\n \"role_data\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"avatar_url\" \tvarchar(2000) NULL,\n \"orcid\" \tvarchar(32) NULL,\n \"notification_frequency\"\tvarchar(32) NULL,\n CONSTRAINT \"PK__fathomne__3213E83F59FE1468\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"fathomnet_identities_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"api_key\" \tvarchar(255) NULL,\n \"avatar_url\" \tvarchar(2000) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"disabled\" \tbit NULL,\n \"display_name\" \tvarchar(255) NULL,\n \"email\" \tvarchar(254) NULL,\n \"expertise_rank\" \tvarchar(32) NULL,\n \"firebase_uid\" \tvarchar(64) NULL,\n \"job_title\" \tvarchar(255) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"orcid\" \tvarchar(32) NULL,\n \"organization\" \tvarchar(255) NULL,\n \"profile\" \tvarchar(1024) NULL,\n \"role_data\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"notification_frequency\"\tvarchar(32) NULL,\n CONSTRAINT \"PK__fathomne__BE3894F9CD98EF78\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"followed_topics\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"email\" \tvarchar(254) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"notification\" \tbit NULL,\n \"target\" \tvarchar(256) NULL,\n \"topic\" \tvarchar(32) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n CONSTRAINT \"PK__followed__3213E83F4A1EA9E0\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"image_set_uploads\" (\n \"id\" \tbigint NOT NULL,\n \"contributors_email\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"format\" \tvarchar(255) NULL,\n \"last_updated_timestamp\" \tdatetime2(6) NULL,\n \"local_path\" \tvarchar(2048) NULL,\n \"rejection_details\" \tvarchar(255) NULL,\n \"rejection_reason\" \tvarchar(255) NULL,\n \"remote_uri\" \tvarchar(2048) NULL,\n \"sha256\" \tvarchar(64) NULL,\n \"status\" \tvarchar(255) NULL,\n \"status_update_timestamp\"\tdatetimeoffset(6) NULL,\n \"status_updater_email\" \tvarchar(254) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"darwincore_id\" \tbigint NULL,\n CONSTRAINT \"PK__image_se__3213E83F9C72A0E9\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"image_uploads_join\" (\n \"imagesetupload_id\"\tbigint NOT NULL,\n \"image_id\" \tbigint NOT NULL,\n CONSTRAINT \"PK__image_up__8A53EE0EBD9D776A\" PRIMARY KEY CLUSTERED(\"imagesetupload_id\",\"image_id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"images\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"depth_meters\" \tfloat NULL,\n \"height\" \tint NULL,\n \"imaging_type\" \tvarchar(64) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"last_validation\" \tdatetimeoffset(6) NULL,\n \"latitude\" \tfloat NULL,\n \"longitude\" \tfloat NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"modified\" \tdatetimeoffset(6) NULL,\n \"sha256\" \tvarchar(64) NULL,\n \"submitter\" \tvarchar(255) NULL,\n \"timestamp\" \tdatetimeoffset(6) NULL,\n \"url\" \tvarchar(2048) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"valid\" \tbit NULL,\n \"width\" \tint NULL,\n \"contributors_email\" \tvarchar(254) NULL,\n \"altitude\" \tfloat NULL,\n \"oxygen_ml_l\" \tfloat NULL,\n \"pressure_dbar\" \tfloat NULL,\n \"salinity\" \tfloat NULL,\n \"temperature_celsius\" \tfloat NULL,\n CONSTRAINT \"PK__images__3213E83FD76E309F\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"images_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"contributors_email\" \tvarchar(254) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"depth_meters\" \tfloat NULL,\n \"height\" \tint NULL,\n \"imaging_type\" \tvarchar(64) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"last_validation\" \tdatetimeoffset(6) NULL,\n \"latitude\" \tfloat NULL,\n \"longitude\" \tfloat NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"modified\" \tdatetimeoffset(6) NULL,\n \"sha256\" \tvarchar(64) NULL,\n \"timestamp\" \tdatetimeoffset(6) NULL,\n \"url\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"valid\" \tbit NULL,\n \"width\" \tint NULL,\n \"altitude\" \tfloat NULL,\n \"oxygen_ml_l\" \tfloat NULL,\n \"pressure_dbar\" \tfloat NULL,\n \"salinity\" \tfloat NULL,\n \"temperature_celsius\" \tfloat NULL,\n CONSTRAINT \"PK__images_a__BE3894F92DF6715C\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"marine_regions\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2 NULL,\n \"last_updated_timestamp\"\tdatetime2 NULL,\n \"max_latitude\" \tfloat NOT NULL,\n \"max_longitude\" \tfloat NOT NULL,\n \"min_latitude\" \tfloat NOT NULL,\n \"min_longitude\" \tfloat NOT NULL,\n \"mrgid\" \tbigint NULL,\n \"name\" \tvarchar(255) NULL,\n CONSTRAINT \"PK__marine_r__3213E83FE987FC8B\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"revinfo\" (\n \"rev\" \tint IDENTITY(1,1) NOT NULL,\n \"revtstmp\"\tbigint NULL,\n CONSTRAINT \"PK__revinfo__C2B7CC69D3938648\" PRIMARY KEY CLUSTERED(\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"tags\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2 NULL,\n \"tag\" \tvarchar(255) NOT NULL,\n \"last_updated_timestamp\"\tdatetime2 NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"value\" \tvarchar(255) NOT NULL,\n \"image_id\" \tbigint NULL,\n CONSTRAINT \"PK__tags__3213E83F3A490684\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"tags_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"created_timestamp\" \tdatetime2 NULL,\n \"tag\" \tvarchar(255) NULL,\n \"last_updated_timestamp\"\tdatetime2 NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"value\" \tvarchar(255) NULL,\n \"image_id\" \tbigint NULL,\n CONSTRAINT \"PK__tags_aud__BE3894F94F1608A8\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE VIEW \"dbo\".\"boundingbox_extended_info\" AS\n SELECT\n b.concept,\n b.alt_concept,\n b.observer,\n b.verified,\n b.verifier,\n b.verification_timestamp,\n b.user_defined_key,\n i.url,\n i.width,\n i.height,\n i.submitter,\n i.[timestamp],\n i.contributors_email AS image_contributors_email,\n u.contributors_email AS upload_contributors_email,\n dc.owner_institution_code,\n dc.institution_code,\n dc.rights_holder,\n dc.collection_code,\n dc.collection_id,\n dc.dataset_name\n FROM\n dbo.darwin_cores dc LEFT JOIN\n dbo.image_set_uploads u ON dc.id = u.darwincore_id LEFT JOIN\n dbo.image_uploads_join j ON j.imagesetupload_id = u.id LEFT JOIN\n dbo.images i ON j.image_id = i.id LEFT JOIN\n dbo.bounding_boxes b ON b.image_id = i.id\n ;\n\n First generate the observation from the prompt and how will you generate thq query, then only generate the prompt. Make sure the sql query is inside ```\n If the prompt is asking about species or images of individual species, draft the sql in such a way that it generates json array containing the species data. Species data must contain species concept and bounding box id as id.\n\n Prompt: Find the species that is found in bounding box table with id 2258719"}, {"role": "assistant", "content": "Observation:You need to find the detail of specific species from the database. So you need to format the output such that it is a json and has species array that has species concept as concept and species bounding box id as id\n\nSql Query:```SELECT concept, id\nFROM dbo.bounding_boxes \nWHERE id = 2258719\nFOR JSON PATH;```"}]}
{"messages": [{"role": "system", "content": "You are a text-to-sql generator. You have a database of marine species. The sql should be generated in a way such that the response from sql is a json. "}, {"role": "user", "content": "\n The database has the following structure.\n\n CREATE TABLE \"dbo\".\"bounding_box_comments\" (\n \"id\" \tbigint NOT NULL,\n \"bounding_box_uuid\" \tuniqueidentifier NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"email\" \tvarchar(254) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"text\" \tvarchar(2048) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"alternate_concept\" \tvarchar(255) NULL,\n \"flagged\" \tbit NULL,\n CONSTRAINT \"PK__bounding__3213E83F71625CCD\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"bounding_boxes\" (\n \"id\" \tbigint NOT NULL,\n \"concept\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"group_of\" \tbit NULL,\n \"height\" \tint NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"observer\" \tvarchar(256) NULL,\n \"occluded\" \tbit NULL,\n \"truncated\" \tbit NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"verification_timestamp\"\tdatetimeoffset(6) NULL,\n \"verified\" \tbit NULL,\n \"verifier\" \tvarchar(256) NULL,\n \"width\" \tint NULL,\n \"x\" \tint NULL,\n \"y\" \tint NULL,\n \"image_id\" \tbigint NULL,\n \"alt_concept\" \tvarchar(255) NULL,\n \"user_defined_key\" \tvarchar(56) NULL,\n CONSTRAINT \"PK__bounding__3213E83F3E4C2D08\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"bounding_boxes_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"concept\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"group_of\" \tbit NULL,\n \"height\" \tint NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"observer\" \tvarchar(256) NULL,\n \"occluded\" \tbit NULL,\n \"truncated\" \tbit NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"verification_timestamp\"\tdatetimeoffset(6) NULL,\n \"verified\" \tbit NULL,\n \"verifier\" \tvarchar(256) NULL,\n \"width\" \tint NULL,\n \"x\" \tint NULL,\n \"y\" \tint NULL,\n \"image_id\" \tbigint NULL,\n \"alt_concept\" \tvarchar(255) NULL,\n \"user_defined_key\" \tvarchar(56) NULL,\n CONSTRAINT \"PK__bounding__BE3894F99D30F28A\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"darwin_cores\" (\n \"id\" \tbigint NOT NULL,\n \"access_rights\" \tvarchar(1024) NULL,\n \"basis_of_record\" \tvarchar(64) NULL,\n \"bibliographic_citation\"\tvarchar(512) NULL,\n \"collection_code\" \tvarchar(64) NULL,\n \"collection_id\" \tvarchar(2048) NULL,\n \"data_generalizations\" \tvarchar(512) NULL,\n \"dataset_id\" \tuniqueidentifier NULL,\n \"dataset_name\" \tvarchar(255) NULL,\n \"dynamic_properties\" \tvarchar(2048) NULL,\n \"information_withheld\" \tvarchar(255) NULL,\n \"institution_code\" \tvarchar(255) NULL,\n \"institution_id\" \tvarchar(255) NULL,\n \"license\" \tvarchar(2048) NULL,\n \"modified\" \tdatetimeoffset(6) NULL,\n \"owner_institution_code\"\tvarchar(255) NULL,\n \"record_language\" \tvarchar(35) NULL,\n \"record_references\" \tvarchar(2048) NULL,\n \"record_type\" \tvarchar(32) NULL,\n \"rights_holder\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"image_set_upload_id\" \tbigint NULL,\n CONSTRAINT \"PK__darwin_c__3213E83F92DAE497\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"fathomnet_identities\" (\n \"id\" \tbigint NOT NULL,\n \"api_key\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"disabled\" \tbit NULL,\n \"display_name\" \tvarchar(255) NULL,\n \"email\" \tvarchar(255) NULL,\n \"expertise_rank\" \tvarchar(32) NULL,\n \"firebase_uid\" \tvarchar(255) NULL,\n \"job_title\" \tvarchar(255) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"organization\" \tvarchar(255) NULL,\n \"profile\" \tvarchar(1024) NULL,\n \"role_data\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"avatar_url\" \tvarchar(2000) NULL,\n \"orcid\" \tvarchar(32) NULL,\n \"notification_frequency\"\tvarchar(32) NULL,\n CONSTRAINT \"PK__fathomne__3213E83F59FE1468\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"fathomnet_identities_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"api_key\" \tvarchar(255) NULL,\n \"avatar_url\" \tvarchar(2000) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"disabled\" \tbit NULL,\n \"display_name\" \tvarchar(255) NULL,\n \"email\" \tvarchar(254) NULL,\n \"expertise_rank\" \tvarchar(32) NULL,\n \"firebase_uid\" \tvarchar(64) NULL,\n \"job_title\" \tvarchar(255) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"orcid\" \tvarchar(32) NULL,\n \"organization\" \tvarchar(255) NULL,\n \"profile\" \tvarchar(1024) NULL,\n \"role_data\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"notification_frequency\"\tvarchar(32) NULL,\n CONSTRAINT \"PK__fathomne__BE3894F9CD98EF78\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"followed_topics\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"email\" \tvarchar(254) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"notification\" \tbit NULL,\n \"target\" \tvarchar(256) NULL,\n \"topic\" \tvarchar(32) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n CONSTRAINT \"PK__followed__3213E83F4A1EA9E0\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"image_set_uploads\" (\n \"id\" \tbigint NOT NULL,\n \"contributors_email\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"format\" \tvarchar(255) NULL,\n \"last_updated_timestamp\" \tdatetime2(6) NULL,\n \"local_path\" \tvarchar(2048) NULL,\n \"rejection_details\" \tvarchar(255) NULL,\n \"rejection_reason\" \tvarchar(255) NULL,\n \"remote_uri\" \tvarchar(2048) NULL,\n \"sha256\" \tvarchar(64) NULL,\n \"status\" \tvarchar(255) NULL,\n \"status_update_timestamp\"\tdatetimeoffset(6) NULL,\n \"status_updater_email\" \tvarchar(254) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"darwincore_id\" \tbigint NULL,\n CONSTRAINT \"PK__image_se__3213E83F9C72A0E9\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"image_uploads_join\" (\n \"imagesetupload_id\"\tbigint NOT NULL,\n \"image_id\" \tbigint NOT NULL,\n CONSTRAINT \"PK__image_up__8A53EE0EBD9D776A\" PRIMARY KEY CLUSTERED(\"imagesetupload_id\",\"image_id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"images\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"depth_meters\" \tfloat NULL,\n \"height\" \tint NULL,\n \"imaging_type\" \tvarchar(64) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"last_validation\" \tdatetimeoffset(6) NULL,\n \"latitude\" \tfloat NULL,\n \"longitude\" \tfloat NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"modified\" \tdatetimeoffset(6) NULL,\n \"sha256\" \tvarchar(64) NULL,\n \"submitter\" \tvarchar(255) NULL,\n \"timestamp\" \tdatetimeoffset(6) NULL,\n \"url\" \tvarchar(2048) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"valid\" \tbit NULL,\n \"width\" \tint NULL,\n \"contributors_email\" \tvarchar(254) NULL,\n \"altitude\" \tfloat NULL,\n \"oxygen_ml_l\" \tfloat NULL,\n \"pressure_dbar\" \tfloat NULL,\n \"salinity\" \tfloat NULL,\n \"temperature_celsius\" \tfloat NULL,\n CONSTRAINT \"PK__images__3213E83FD76E309F\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"images_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"contributors_email\" \tvarchar(254) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"depth_meters\" \tfloat NULL,\n \"height\" \tint NULL,\n \"imaging_type\" \tvarchar(64) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"last_validation\" \tdatetimeoffset(6) NULL,\n \"latitude\" \tfloat NULL,\n \"longitude\" \tfloat NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"modified\" \tdatetimeoffset(6) NULL,\n \"sha256\" \tvarchar(64) NULL,\n \"timestamp\" \tdatetimeoffset(6) NULL,\n \"url\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"valid\" \tbit NULL,\n \"width\" \tint NULL,\n \"altitude\" \tfloat NULL,\n \"oxygen_ml_l\" \tfloat NULL,\n \"pressure_dbar\" \tfloat NULL,\n \"salinity\" \tfloat NULL,\n \"temperature_celsius\" \tfloat NULL,\n CONSTRAINT \"PK__images_a__BE3894F92DF6715C\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"marine_regions\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2 NULL,\n \"last_updated_timestamp\"\tdatetime2 NULL,\n \"max_latitude\" \tfloat NOT NULL,\n \"max_longitude\" \tfloat NOT NULL,\n \"min_latitude\" \tfloat NOT NULL,\n \"min_longitude\" \tfloat NOT NULL,\n \"mrgid\" \tbigint NULL,\n \"name\" \tvarchar(255) NULL,\n CONSTRAINT \"PK__marine_r__3213E83FE987FC8B\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"revinfo\" (\n \"rev\" \tint IDENTITY(1,1) NOT NULL,\n \"revtstmp\"\tbigint NULL,\n CONSTRAINT \"PK__revinfo__C2B7CC69D3938648\" PRIMARY KEY CLUSTERED(\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"tags\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2 NULL,\n \"tag\" \tvarchar(255) NOT NULL,\n \"last_updated_timestamp\"\tdatetime2 NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"value\" \tvarchar(255) NOT NULL,\n \"image_id\" \tbigint NULL,\n CONSTRAINT \"PK__tags__3213E83F3A490684\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"tags_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"created_timestamp\" \tdatetime2 NULL,\n \"tag\" \tvarchar(255) NULL,\n \"last_updated_timestamp\"\tdatetime2 NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"value\" \tvarchar(255) NULL,\n \"image_id\" \tbigint NULL,\n CONSTRAINT \"PK__tags_aud__BE3894F94F1608A8\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE VIEW \"dbo\".\"boundingbox_extended_info\" AS\n SELECT\n b.concept,\n b.alt_concept,\n b.observer,\n b.verified,\n b.verifier,\n b.verification_timestamp,\n b.user_defined_key,\n i.url,\n i.width,\n i.height,\n i.submitter,\n i.[timestamp],\n i.contributors_email AS image_contributors_email,\n u.contributors_email AS upload_contributors_email,\n dc.owner_institution_code,\n dc.institution_code,\n dc.rights_holder,\n dc.collection_code,\n dc.collection_id,\n dc.dataset_name\n FROM\n dbo.darwin_cores dc LEFT JOIN\n dbo.image_set_uploads u ON dc.id = u.darwincore_id LEFT JOIN\n dbo.image_uploads_join j ON j.imagesetupload_id = u.id LEFT JOIN\n dbo.images i ON j.image_id = i.id LEFT JOIN\n dbo.bounding_boxes b ON b.image_id = i.id\n ;\n\n First generate the observation from the prompt and how will you generate thq query, then only generate the prompt. Make sure the sql query is inside ```\n If the prompt is asking about species or images of individual species, draft the sql in such a way that it generates json array containing the species data. Species data must contain species concept and bounding box id as id.\n\n Prompt: Identify the two species that most frequently appear together within a single image"}, {"role": "assistant", "content": "Observation:You need to find out any two species which are found the most in a single image, so you need to combine the bounding_boxes and compare the image_id of the two species.\n\nSql Query:```SELECT TOP 1\n bb1.concept AS species1, \n bb2.concept AS species2, \n COUNT(*) AS frequency\nFROM \n dbo.bounding_boxes AS bb1\nJOIN \n dbo.bounding_boxes AS bb2 \nON \n bb1.image_id = bb2.image_id AND bb1.concept < bb2.concept\nGROUP BY \n bb1.concept, \n bb2.concept```"}]}
{"messages": [{"role": "system", "content": "You are a text-to-sql generator. You have a database of marine species. The sql should be generated in a way such that the response from sql is a json. "}, {"role": "user", "content": "\n The database has the following structure.\n\n CREATE TABLE \"dbo\".\"bounding_box_comments\" (\n \"id\" \tbigint NOT NULL,\n \"bounding_box_uuid\" \tuniqueidentifier NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"email\" \tvarchar(254) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"text\" \tvarchar(2048) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"alternate_concept\" \tvarchar(255) NULL,\n \"flagged\" \tbit NULL,\n CONSTRAINT \"PK__bounding__3213E83F71625CCD\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"bounding_boxes\" (\n \"id\" \tbigint NOT NULL,\n \"concept\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"group_of\" \tbit NULL,\n \"height\" \tint NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"observer\" \tvarchar(256) NULL,\n \"occluded\" \tbit NULL,\n \"truncated\" \tbit NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"verification_timestamp\"\tdatetimeoffset(6) NULL,\n \"verified\" \tbit NULL,\n \"verifier\" \tvarchar(256) NULL,\n \"width\" \tint NULL,\n \"x\" \tint NULL,\n \"y\" \tint NULL,\n \"image_id\" \tbigint NULL,\n \"alt_concept\" \tvarchar(255) NULL,\n \"user_defined_key\" \tvarchar(56) NULL,\n CONSTRAINT \"PK__bounding__3213E83F3E4C2D08\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"bounding_boxes_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"concept\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"group_of\" \tbit NULL,\n \"height\" \tint NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"observer\" \tvarchar(256) NULL,\n \"occluded\" \tbit NULL,\n \"truncated\" \tbit NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"verification_timestamp\"\tdatetimeoffset(6) NULL,\n \"verified\" \tbit NULL,\n \"verifier\" \tvarchar(256) NULL,\n \"width\" \tint NULL,\n \"x\" \tint NULL,\n \"y\" \tint NULL,\n \"image_id\" \tbigint NULL,\n \"alt_concept\" \tvarchar(255) NULL,\n \"user_defined_key\" \tvarchar(56) NULL,\n CONSTRAINT \"PK__bounding__BE3894F99D30F28A\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"darwin_cores\" (\n \"id\" \tbigint NOT NULL,\n \"access_rights\" \tvarchar(1024) NULL,\n \"basis_of_record\" \tvarchar(64) NULL,\n \"bibliographic_citation\"\tvarchar(512) NULL,\n \"collection_code\" \tvarchar(64) NULL,\n \"collection_id\" \tvarchar(2048) NULL,\n \"data_generalizations\" \tvarchar(512) NULL,\n \"dataset_id\" \tuniqueidentifier NULL,\n \"dataset_name\" \tvarchar(255) NULL,\n \"dynamic_properties\" \tvarchar(2048) NULL,\n \"information_withheld\" \tvarchar(255) NULL,\n \"institution_code\" \tvarchar(255) NULL,\n \"institution_id\" \tvarchar(255) NULL,\n \"license\" \tvarchar(2048) NULL,\n \"modified\" \tdatetimeoffset(6) NULL,\n \"owner_institution_code\"\tvarchar(255) NULL,\n \"record_language\" \tvarchar(35) NULL,\n \"record_references\" \tvarchar(2048) NULL,\n \"record_type\" \tvarchar(32) NULL,\n \"rights_holder\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"image_set_upload_id\" \tbigint NULL,\n CONSTRAINT \"PK__darwin_c__3213E83F92DAE497\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"fathomnet_identities\" (\n \"id\" \tbigint NOT NULL,\n \"api_key\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"disabled\" \tbit NULL,\n \"display_name\" \tvarchar(255) NULL,\n \"email\" \tvarchar(255) NULL,\n \"expertise_rank\" \tvarchar(32) NULL,\n \"firebase_uid\" \tvarchar(255) NULL,\n \"job_title\" \tvarchar(255) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"organization\" \tvarchar(255) NULL,\n \"profile\" \tvarchar(1024) NULL,\n \"role_data\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"avatar_url\" \tvarchar(2000) NULL,\n \"orcid\" \tvarchar(32) NULL,\n \"notification_frequency\"\tvarchar(32) NULL,\n CONSTRAINT \"PK__fathomne__3213E83F59FE1468\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"fathomnet_identities_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"api_key\" \tvarchar(255) NULL,\n \"avatar_url\" \tvarchar(2000) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"disabled\" \tbit NULL,\n \"display_name\" \tvarchar(255) NULL,\n \"email\" \tvarchar(254) NULL,\n \"expertise_rank\" \tvarchar(32) NULL,\n \"firebase_uid\" \tvarchar(64) NULL,\n \"job_title\" \tvarchar(255) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"orcid\" \tvarchar(32) NULL,\n \"organization\" \tvarchar(255) NULL,\n \"profile\" \tvarchar(1024) NULL,\n \"role_data\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"notification_frequency\"\tvarchar(32) NULL,\n CONSTRAINT \"PK__fathomne__BE3894F9CD98EF78\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"followed_topics\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"email\" \tvarchar(254) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"notification\" \tbit NULL,\n \"target\" \tvarchar(256) NULL,\n \"topic\" \tvarchar(32) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n CONSTRAINT \"PK__followed__3213E83F4A1EA9E0\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"image_set_uploads\" (\n \"id\" \tbigint NOT NULL,\n \"contributors_email\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"format\" \tvarchar(255) NULL,\n \"last_updated_timestamp\" \tdatetime2(6) NULL,\n \"local_path\" \tvarchar(2048) NULL,\n \"rejection_details\" \tvarchar(255) NULL,\n \"rejection_reason\" \tvarchar(255) NULL,\n \"remote_uri\" \tvarchar(2048) NULL,\n \"sha256\" \tvarchar(64) NULL,\n \"status\" \tvarchar(255) NULL,\n \"status_update_timestamp\"\tdatetimeoffset(6) NULL,\n \"status_updater_email\" \tvarchar(254) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"darwincore_id\" \tbigint NULL,\n CONSTRAINT \"PK__image_se__3213E83F9C72A0E9\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"image_uploads_join\" (\n \"imagesetupload_id\"\tbigint NOT NULL,\n \"image_id\" \tbigint NOT NULL,\n CONSTRAINT \"PK__image_up__8A53EE0EBD9D776A\" PRIMARY KEY CLUSTERED(\"imagesetupload_id\",\"image_id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"images\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"depth_meters\" \tfloat NULL,\n \"height\" \tint NULL,\n \"imaging_type\" \tvarchar(64) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"last_validation\" \tdatetimeoffset(6) NULL,\n \"latitude\" \tfloat NULL,\n \"longitude\" \tfloat NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"modified\" \tdatetimeoffset(6) NULL,\n \"sha256\" \tvarchar(64) NULL,\n \"submitter\" \tvarchar(255) NULL,\n \"timestamp\" \tdatetimeoffset(6) NULL,\n \"url\" \tvarchar(2048) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"valid\" \tbit NULL,\n \"width\" \tint NULL,\n \"contributors_email\" \tvarchar(254) NULL,\n \"altitude\" \tfloat NULL,\n \"oxygen_ml_l\" \tfloat NULL,\n \"pressure_dbar\" \tfloat NULL,\n \"salinity\" \tfloat NULL,\n \"temperature_celsius\" \tfloat NULL,\n CONSTRAINT \"PK__images__3213E83FD76E309F\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"images_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"contributors_email\" \tvarchar(254) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"depth_meters\" \tfloat NULL,\n \"height\" \tint NULL,\n \"imaging_type\" \tvarchar(64) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"last_validation\" \tdatetimeoffset(6) NULL,\n \"latitude\" \tfloat NULL,\n \"longitude\" \tfloat NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"modified\" \tdatetimeoffset(6) NULL,\n \"sha256\" \tvarchar(64) NULL,\n \"timestamp\" \tdatetimeoffset(6) NULL,\n \"url\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"valid\" \tbit NULL,\n \"width\" \tint NULL,\n \"altitude\" \tfloat NULL,\n \"oxygen_ml_l\" \tfloat NULL,\n \"pressure_dbar\" \tfloat NULL,\n \"salinity\" \tfloat NULL,\n \"temperature_celsius\" \tfloat NULL,\n CONSTRAINT \"PK__images_a__BE3894F92DF6715C\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"marine_regions\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2 NULL,\n \"last_updated_timestamp\"\tdatetime2 NULL,\n \"max_latitude\" \tfloat NOT NULL,\n \"max_longitude\" \tfloat NOT NULL,\n \"min_latitude\" \tfloat NOT NULL,\n \"min_longitude\" \tfloat NOT NULL,\n \"mrgid\" \tbigint NULL,\n \"name\" \tvarchar(255) NULL,\n CONSTRAINT \"PK__marine_r__3213E83FE987FC8B\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"revinfo\" (\n \"rev\" \tint IDENTITY(1,1) NOT NULL,\n \"revtstmp\"\tbigint NULL,\n CONSTRAINT \"PK__revinfo__C2B7CC69D3938648\" PRIMARY KEY CLUSTERED(\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"tags\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2 NULL,\n \"tag\" \tvarchar(255) NOT NULL,\n \"last_updated_timestamp\"\tdatetime2 NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"value\" \tvarchar(255) NOT NULL,\n \"image_id\" \tbigint NULL,\n CONSTRAINT \"PK__tags__3213E83F3A490684\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"tags_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"created_timestamp\" \tdatetime2 NULL,\n \"tag\" \tvarchar(255) NULL,\n \"last_updated_timestamp\"\tdatetime2 NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"value\" \tvarchar(255) NULL,\n \"image_id\" \tbigint NULL,\n CONSTRAINT \"PK__tags_aud__BE3894F94F1608A8\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE VIEW \"dbo\".\"boundingbox_extended_info\" AS\n SELECT\n b.concept,\n b.alt_concept,\n b.observer,\n b.verified,\n b.verifier,\n b.verification_timestamp,\n b.user_defined_key,\n i.url,\n i.width,\n i.height,\n i.submitter,\n i.[timestamp],\n i.contributors_email AS image_contributors_email,\n u.contributors_email AS upload_contributors_email,\n dc.owner_institution_code,\n dc.institution_code,\n dc.rights_holder,\n dc.collection_code,\n dc.collection_id,\n dc.dataset_name\n FROM\n dbo.darwin_cores dc LEFT JOIN\n dbo.image_set_uploads u ON dc.id = u.darwincore_id LEFT JOIN\n dbo.image_uploads_join j ON j.imagesetupload_id = u.id LEFT JOIN\n dbo.images i ON j.image_id = i.id LEFT JOIN\n dbo.bounding_boxes b ON b.image_id = i.id\n ;\n\n First generate the observation from the prompt and how will you generate thq query, then only generate the prompt. Make sure the sql query is inside ```\n If the prompt is asking about species or images of individual species, draft the sql in such a way that it generates json array containing the species data. Species data must contain species concept and bounding box id as id.\n\n Prompt: Provide an image showcasing the highest concentration of Bathochordaeus stygius"}, {"role": "assistant", "content": "Observation:You need to find the image from the database so you need to format the output such that it is a json and has species array that has species concept as concept, image url as url, image id as image_id and species bounding box id as id\nAlso in this query asks for image that has many species within a single image, it would be better to include bounding box detail(x, y, width, height) of species\nSo, you will first find out the image that contains highest conceentration of the species. Once you get that data, you will format the result such that it is a json array with species id, image url, image_id and concept\n\nSql Query:```WITH HighestConcentrationImage AS (\n SELECT TOP 1\n i.id as image_id,\n COUNT(b.id) as concentration\n FROM\n dbo.images i\n JOIN\n dbo.bounding_boxes b ON i.id = b.image_id\n WHERE\n b.concept = 'Bathochordaeus stygius' OR b.alt_concept = 'Bathochordaeus stygius'\n GROUP BY\n i.id\n ORDER BY\n concentration DESC\n)\nSELECT \n b.id,\n b.concept,\n i.url,\n i.id as image_id,\n b.x,\n b.y,\n b.width,\n b.height\nFROM \n dbo.images i\nJOIN \n dbo.bounding_boxes b ON i.id = b.image_id\nJOIN \n HighestConcentrationImage hci ON hci.image_id = i.id\nWHERE \n b.concept = 'Bathochordaeus stygius'\nFOR JSON PATH```"}]}
{"messages": [{"role": "system", "content": "You are a text-to-sql generator. You have a database of marine species. The sql should be generated in a way such that the response from sql is a json. "}, {"role": "user", "content": "\n The database has the following structure.\n\n CREATE TABLE \"dbo\".\"bounding_box_comments\" (\n \"id\" \tbigint NOT NULL,\n \"bounding_box_uuid\" \tuniqueidentifier NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"email\" \tvarchar(254) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"text\" \tvarchar(2048) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"alternate_concept\" \tvarchar(255) NULL,\n \"flagged\" \tbit NULL,\n CONSTRAINT \"PK__bounding__3213E83F71625CCD\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"bounding_boxes\" (\n \"id\" \tbigint NOT NULL,\n \"concept\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"group_of\" \tbit NULL,\n \"height\" \tint NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"observer\" \tvarchar(256) NULL,\n \"occluded\" \tbit NULL,\n \"truncated\" \tbit NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"verification_timestamp\"\tdatetimeoffset(6) NULL,\n \"verified\" \tbit NULL,\n \"verifier\" \tvarchar(256) NULL,\n \"width\" \tint NULL,\n \"x\" \tint NULL,\n \"y\" \tint NULL,\n \"image_id\" \tbigint NULL,\n \"alt_concept\" \tvarchar(255) NULL,\n \"user_defined_key\" \tvarchar(56) NULL,\n CONSTRAINT \"PK__bounding__3213E83F3E4C2D08\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"bounding_boxes_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"concept\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"group_of\" \tbit NULL,\n \"height\" \tint NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"observer\" \tvarchar(256) NULL,\n \"occluded\" \tbit NULL,\n \"truncated\" \tbit NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"verification_timestamp\"\tdatetimeoffset(6) NULL,\n \"verified\" \tbit NULL,\n \"verifier\" \tvarchar(256) NULL,\n \"width\" \tint NULL,\n \"x\" \tint NULL,\n \"y\" \tint NULL,\n \"image_id\" \tbigint NULL,\n \"alt_concept\" \tvarchar(255) NULL,\n \"user_defined_key\" \tvarchar(56) NULL,\n CONSTRAINT \"PK__bounding__BE3894F99D30F28A\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"darwin_cores\" (\n \"id\" \tbigint NOT NULL,\n \"access_rights\" \tvarchar(1024) NULL,\n \"basis_of_record\" \tvarchar(64) NULL,\n \"bibliographic_citation\"\tvarchar(512) NULL,\n \"collection_code\" \tvarchar(64) NULL,\n \"collection_id\" \tvarchar(2048) NULL,\n \"data_generalizations\" \tvarchar(512) NULL,\n \"dataset_id\" \tuniqueidentifier NULL,\n \"dataset_name\" \tvarchar(255) NULL,\n \"dynamic_properties\" \tvarchar(2048) NULL,\n \"information_withheld\" \tvarchar(255) NULL,\n \"institution_code\" \tvarchar(255) NULL,\n \"institution_id\" \tvarchar(255) NULL,\n \"license\" \tvarchar(2048) NULL,\n \"modified\" \tdatetimeoffset(6) NULL,\n \"owner_institution_code\"\tvarchar(255) NULL,\n \"record_language\" \tvarchar(35) NULL,\n \"record_references\" \tvarchar(2048) NULL,\n \"record_type\" \tvarchar(32) NULL,\n \"rights_holder\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"image_set_upload_id\" \tbigint NULL,\n CONSTRAINT \"PK__darwin_c__3213E83F92DAE497\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"fathomnet_identities\" (\n \"id\" \tbigint NOT NULL,\n \"api_key\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"disabled\" \tbit NULL,\n \"display_name\" \tvarchar(255) NULL,\n \"email\" \tvarchar(255) NULL,\n \"expertise_rank\" \tvarchar(32) NULL,\n \"firebase_uid\" \tvarchar(255) NULL,\n \"job_title\" \tvarchar(255) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"organization\" \tvarchar(255) NULL,\n \"profile\" \tvarchar(1024) NULL,\n \"role_data\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"avatar_url\" \tvarchar(2000) NULL,\n \"orcid\" \tvarchar(32) NULL,\n \"notification_frequency\"\tvarchar(32) NULL,\n CONSTRAINT \"PK__fathomne__3213E83F59FE1468\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"fathomnet_identities_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"api_key\" \tvarchar(255) NULL,\n \"avatar_url\" \tvarchar(2000) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"disabled\" \tbit NULL,\n \"display_name\" \tvarchar(255) NULL,\n \"email\" \tvarchar(254) NULL,\n \"expertise_rank\" \tvarchar(32) NULL,\n \"firebase_uid\" \tvarchar(64) NULL,\n \"job_title\" \tvarchar(255) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"orcid\" \tvarchar(32) NULL,\n \"organization\" \tvarchar(255) NULL,\n \"profile\" \tvarchar(1024) NULL,\n \"role_data\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"notification_frequency\"\tvarchar(32) NULL,\n CONSTRAINT \"PK__fathomne__BE3894F9CD98EF78\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"followed_topics\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"email\" \tvarchar(254) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"notification\" \tbit NULL,\n \"target\" \tvarchar(256) NULL,\n \"topic\" \tvarchar(32) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n CONSTRAINT \"PK__followed__3213E83F4A1EA9E0\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"image_set_uploads\" (\n \"id\" \tbigint NOT NULL,\n \"contributors_email\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"format\" \tvarchar(255) NULL,\n \"last_updated_timestamp\" \tdatetime2(6) NULL,\n \"local_path\" \tvarchar(2048) NULL,\n \"rejection_details\" \tvarchar(255) NULL,\n \"rejection_reason\" \tvarchar(255) NULL,\n \"remote_uri\" \tvarchar(2048) NULL,\n \"sha256\" \tvarchar(64) NULL,\n \"status\" \tvarchar(255) NULL,\n \"status_update_timestamp\"\tdatetimeoffset(6) NULL,\n \"status_updater_email\" \tvarchar(254) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"darwincore_id\" \tbigint NULL,\n CONSTRAINT \"PK__image_se__3213E83F9C72A0E9\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"image_uploads_join\" (\n \"imagesetupload_id\"\tbigint NOT NULL,\n \"image_id\" \tbigint NOT NULL,\n CONSTRAINT \"PK__image_up__8A53EE0EBD9D776A\" PRIMARY KEY CLUSTERED(\"imagesetupload_id\",\"image_id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"images\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"depth_meters\" \tfloat NULL,\n \"height\" \tint NULL,\n \"imaging_type\" \tvarchar(64) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"last_validation\" \tdatetimeoffset(6) NULL,\n \"latitude\" \tfloat NULL,\n \"longitude\" \tfloat NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"modified\" \tdatetimeoffset(6) NULL,\n \"sha256\" \tvarchar(64) NULL,\n \"submitter\" \tvarchar(255) NULL,\n \"timestamp\" \tdatetimeoffset(6) NULL,\n \"url\" \tvarchar(2048) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"valid\" \tbit NULL,\n \"width\" \tint NULL,\n \"contributors_email\" \tvarchar(254) NULL,\n \"altitude\" \tfloat NULL,\n \"oxygen_ml_l\" \tfloat NULL,\n \"pressure_dbar\" \tfloat NULL,\n \"salinity\" \tfloat NULL,\n \"temperature_celsius\" \tfloat NULL,\n CONSTRAINT \"PK__images__3213E83FD76E309F\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"images_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"contributors_email\" \tvarchar(254) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"depth_meters\" \tfloat NULL,\n \"height\" \tint NULL,\n \"imaging_type\" \tvarchar(64) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"last_validation\" \tdatetimeoffset(6) NULL,\n \"latitude\" \tfloat NULL,\n \"longitude\" \tfloat NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"modified\" \tdatetimeoffset(6) NULL,\n \"sha256\" \tvarchar(64) NULL,\n \"timestamp\" \tdatetimeoffset(6) NULL,\n \"url\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"valid\" \tbit NULL,\n \"width\" \tint NULL,\n \"altitude\" \tfloat NULL,\n \"oxygen_ml_l\" \tfloat NULL,\n \"pressure_dbar\" \tfloat NULL,\n \"salinity\" \tfloat NULL,\n \"temperature_celsius\" \tfloat NULL,\n CONSTRAINT \"PK__images_a__BE3894F92DF6715C\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"marine_regions\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2 NULL,\n \"last_updated_timestamp\"\tdatetime2 NULL,\n \"max_latitude\" \tfloat NOT NULL,\n \"max_longitude\" \tfloat NOT NULL,\n \"min_latitude\" \tfloat NOT NULL,\n \"min_longitude\" \tfloat NOT NULL,\n \"mrgid\" \tbigint NULL,\n \"name\" \tvarchar(255) NULL,\n CONSTRAINT \"PK__marine_r__3213E83FE987FC8B\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"revinfo\" (\n \"rev\" \tint IDENTITY(1,1) NOT NULL,\n \"revtstmp\"\tbigint NULL,\n CONSTRAINT \"PK__revinfo__C2B7CC69D3938648\" PRIMARY KEY CLUSTERED(\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"tags\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2 NULL,\n \"tag\" \tvarchar(255) NOT NULL,\n \"last_updated_timestamp\"\tdatetime2 NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"value\" \tvarchar(255) NOT NULL,\n \"image_id\" \tbigint NULL,\n CONSTRAINT \"PK__tags__3213E83F3A490684\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"tags_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"created_timestamp\" \tdatetime2 NULL,\n \"tag\" \tvarchar(255) NULL,\n \"last_updated_timestamp\"\tdatetime2 NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"value\" \tvarchar(255) NULL,\n \"image_id\" \tbigint NULL,\n CONSTRAINT \"PK__tags_aud__BE3894F94F1608A8\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE VIEW \"dbo\".\"boundingbox_extended_info\" AS\n SELECT\n b.concept,\n b.alt_concept,\n b.observer,\n b.verified,\n b.verifier,\n b.verification_timestamp,\n b.user_defined_key,\n i.url,\n i.width,\n i.height,\n i.submitter,\n i.[timestamp],\n i.contributors_email AS image_contributors_email,\n u.contributors_email AS upload_contributors_email,\n dc.owner_institution_code,\n dc.institution_code,\n dc.rights_holder,\n dc.collection_code,\n dc.collection_id,\n dc.dataset_name\n FROM\n dbo.darwin_cores dc LEFT JOIN\n dbo.image_set_uploads u ON dc.id = u.darwincore_id LEFT JOIN\n dbo.image_uploads_join j ON j.imagesetupload_id = u.id LEFT JOIN\n dbo.images i ON j.image_id = i.id LEFT JOIN\n dbo.bounding_boxes b ON b.image_id = i.id\n ;\n\n First generate the observation from the prompt and how will you generate thq query, then only generate the prompt. Make sure the sql query is inside ```\n If the prompt is asking about species or images of individual species, draft the sql in such a way that it generates json array containing the species data. Species data must contain species concept and bounding box id as id.\n\n Prompt: In what pressure level is the species with bounding box id 2258729 living at"}, {"role": "assistant", "content": "Observation:You need to find the pressure level the species with bounding box id 2258729 living at so you can find it by first finding the image data such that it has image id same as the bounding box image id and then find the value that is in the pressure_dbar column\n\nSql Query:```\nSELECT images.pressure_dbar\nFROM dbo.bounding_boxes\nJOIN dbo.images ON bounding_boxes.image_id = images.id\nWHERE bounding_boxes.id = 2258739;```"}]}
{"messages": [{"role": "system", "content": "You are a text-to-sql generator. You have a database of marine species. The sql should be generated in a way such that the response from sql is a json. "}, {"role": "user", "content": "\n The database has the following structure.\n\n CREATE TABLE \"dbo\".\"bounding_box_comments\" (\n \"id\" \tbigint NOT NULL,\n \"bounding_box_uuid\" \tuniqueidentifier NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"email\" \tvarchar(254) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"text\" \tvarchar(2048) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"alternate_concept\" \tvarchar(255) NULL,\n \"flagged\" \tbit NULL,\n CONSTRAINT \"PK__bounding__3213E83F71625CCD\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"bounding_boxes\" (\n \"id\" \tbigint NOT NULL,\n \"concept\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"group_of\" \tbit NULL,\n \"height\" \tint NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"observer\" \tvarchar(256) NULL,\n \"occluded\" \tbit NULL,\n \"truncated\" \tbit NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"verification_timestamp\"\tdatetimeoffset(6) NULL,\n \"verified\" \tbit NULL,\n \"verifier\" \tvarchar(256) NULL,\n \"width\" \tint NULL,\n \"x\" \tint NULL,\n \"y\" \tint NULL,\n \"image_id\" \tbigint NULL,\n \"alt_concept\" \tvarchar(255) NULL,\n \"user_defined_key\" \tvarchar(56) NULL,\n CONSTRAINT \"PK__bounding__3213E83F3E4C2D08\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"bounding_boxes_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"concept\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"group_of\" \tbit NULL,\n \"height\" \tint NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"observer\" \tvarchar(256) NULL,\n \"occluded\" \tbit NULL,\n \"truncated\" \tbit NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"verification_timestamp\"\tdatetimeoffset(6) NULL,\n \"verified\" \tbit NULL,\n \"verifier\" \tvarchar(256) NULL,\n \"width\" \tint NULL,\n \"x\" \tint NULL,\n \"y\" \tint NULL,\n \"image_id\" \tbigint NULL,\n \"alt_concept\" \tvarchar(255) NULL,\n \"user_defined_key\" \tvarchar(56) NULL,\n CONSTRAINT \"PK__bounding__BE3894F99D30F28A\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"darwin_cores\" (\n \"id\" \tbigint NOT NULL,\n \"access_rights\" \tvarchar(1024) NULL,\n \"basis_of_record\" \tvarchar(64) NULL,\n \"bibliographic_citation\"\tvarchar(512) NULL,\n \"collection_code\" \tvarchar(64) NULL,\n \"collection_id\" \tvarchar(2048) NULL,\n \"data_generalizations\" \tvarchar(512) NULL,\n \"dataset_id\" \tuniqueidentifier NULL,\n \"dataset_name\" \tvarchar(255) NULL,\n \"dynamic_properties\" \tvarchar(2048) NULL,\n \"information_withheld\" \tvarchar(255) NULL,\n \"institution_code\" \tvarchar(255) NULL,\n \"institution_id\" \tvarchar(255) NULL,\n \"license\" \tvarchar(2048) NULL,\n \"modified\" \tdatetimeoffset(6) NULL,\n \"owner_institution_code\"\tvarchar(255) NULL,\n \"record_language\" \tvarchar(35) NULL,\n \"record_references\" \tvarchar(2048) NULL,\n \"record_type\" \tvarchar(32) NULL,\n \"rights_holder\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"image_set_upload_id\" \tbigint NULL,\n CONSTRAINT \"PK__darwin_c__3213E83F92DAE497\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"fathomnet_identities\" (\n \"id\" \tbigint NOT NULL,\n \"api_key\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"disabled\" \tbit NULL,\n \"display_name\" \tvarchar(255) NULL,\n \"email\" \tvarchar(255) NULL,\n \"expertise_rank\" \tvarchar(32) NULL,\n \"firebase_uid\" \tvarchar(255) NULL,\n \"job_title\" \tvarchar(255) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"organization\" \tvarchar(255) NULL,\n \"profile\" \tvarchar(1024) NULL,\n \"role_data\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"avatar_url\" \tvarchar(2000) NULL,\n \"orcid\" \tvarchar(32) NULL,\n \"notification_frequency\"\tvarchar(32) NULL,\n CONSTRAINT \"PK__fathomne__3213E83F59FE1468\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"fathomnet_identities_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"api_key\" \tvarchar(255) NULL,\n \"avatar_url\" \tvarchar(2000) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"disabled\" \tbit NULL,\n \"display_name\" \tvarchar(255) NULL,\n \"email\" \tvarchar(254) NULL,\n \"expertise_rank\" \tvarchar(32) NULL,\n \"firebase_uid\" \tvarchar(64) NULL,\n \"job_title\" \tvarchar(255) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"orcid\" \tvarchar(32) NULL,\n \"organization\" \tvarchar(255) NULL,\n \"profile\" \tvarchar(1024) NULL,\n \"role_data\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"notification_frequency\"\tvarchar(32) NULL,\n CONSTRAINT \"PK__fathomne__BE3894F9CD98EF78\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"followed_topics\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"email\" \tvarchar(254) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"notification\" \tbit NULL,\n \"target\" \tvarchar(256) NULL,\n \"topic\" \tvarchar(32) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n CONSTRAINT \"PK__followed__3213E83F4A1EA9E0\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"image_set_uploads\" (\n \"id\" \tbigint NOT NULL,\n \"contributors_email\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"format\" \tvarchar(255) NULL,\n \"last_updated_timestamp\" \tdatetime2(6) NULL,\n \"local_path\" \tvarchar(2048) NULL,\n \"rejection_details\" \tvarchar(255) NULL,\n \"rejection_reason\" \tvarchar(255) NULL,\n \"remote_uri\" \tvarchar(2048) NULL,\n \"sha256\" \tvarchar(64) NULL,\n \"status\" \tvarchar(255) NULL,\n \"status_update_timestamp\"\tdatetimeoffset(6) NULL,\n \"status_updater_email\" \tvarchar(254) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"darwincore_id\" \tbigint NULL,\n CONSTRAINT \"PK__image_se__3213E83F9C72A0E9\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"image_uploads_join\" (\n \"imagesetupload_id\"\tbigint NOT NULL,\n \"image_id\" \tbigint NOT NULL,\n CONSTRAINT \"PK__image_up__8A53EE0EBD9D776A\" PRIMARY KEY CLUSTERED(\"imagesetupload_id\",\"image_id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"images\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"depth_meters\" \tfloat NULL,\n \"height\" \tint NULL,\n \"imaging_type\" \tvarchar(64) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"last_validation\" \tdatetimeoffset(6) NULL,\n \"latitude\" \tfloat NULL,\n \"longitude\" \tfloat NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"modified\" \tdatetimeoffset(6) NULL,\n \"sha256\" \tvarchar(64) NULL,\n \"submitter\" \tvarchar(255) NULL,\n \"timestamp\" \tdatetimeoffset(6) NULL,\n \"url\" \tvarchar(2048) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"valid\" \tbit NULL,\n \"width\" \tint NULL,\n \"contributors_email\" \tvarchar(254) NULL,\n \"altitude\" \tfloat NULL,\n \"oxygen_ml_l\" \tfloat NULL,\n \"pressure_dbar\" \tfloat NULL,\n \"salinity\" \tfloat NULL,\n \"temperature_celsius\" \tfloat NULL,\n CONSTRAINT \"PK__images__3213E83FD76E309F\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"images_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"contributors_email\" \tvarchar(254) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"depth_meters\" \tfloat NULL,\n \"height\" \tint NULL,\n \"imaging_type\" \tvarchar(64) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"last_validation\" \tdatetimeoffset(6) NULL,\n \"latitude\" \tfloat NULL,\n \"longitude\" \tfloat NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"modified\" \tdatetimeoffset(6) NULL,\n \"sha256\" \tvarchar(64) NULL,\n \"timestamp\" \tdatetimeoffset(6) NULL,\n \"url\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"valid\" \tbit NULL,\n \"width\" \tint NULL,\n \"altitude\" \tfloat NULL,\n \"oxygen_ml_l\" \tfloat NULL,\n \"pressure_dbar\" \tfloat NULL,\n \"salinity\" \tfloat NULL,\n \"temperature_celsius\" \tfloat NULL,\n CONSTRAINT \"PK__images_a__BE3894F92DF6715C\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"marine_regions\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2 NULL,\n \"last_updated_timestamp\"\tdatetime2 NULL,\n \"max_latitude\" \tfloat NOT NULL,\n \"max_longitude\" \tfloat NOT NULL,\n \"min_latitude\" \tfloat NOT NULL,\n \"min_longitude\" \tfloat NOT NULL,\n \"mrgid\" \tbigint NULL,\n \"name\" \tvarchar(255) NULL,\n CONSTRAINT \"PK__marine_r__3213E83FE987FC8B\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"revinfo\" (\n \"rev\" \tint IDENTITY(1,1) NOT NULL,\n \"revtstmp\"\tbigint NULL,\n CONSTRAINT \"PK__revinfo__C2B7CC69D3938648\" PRIMARY KEY CLUSTERED(\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"tags\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2 NULL,\n \"tag\" \tvarchar(255) NOT NULL,\n \"last_updated_timestamp\"\tdatetime2 NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"value\" \tvarchar(255) NOT NULL,\n \"image_id\" \tbigint NULL,\n CONSTRAINT \"PK__tags__3213E83F3A490684\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"tags_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"created_timestamp\" \tdatetime2 NULL,\n \"tag\" \tvarchar(255) NULL,\n \"last_updated_timestamp\"\tdatetime2 NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"value\" \tvarchar(255) NULL,\n \"image_id\" \tbigint NULL,\n CONSTRAINT \"PK__tags_aud__BE3894F94F1608A8\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE VIEW \"dbo\".\"boundingbox_extended_info\" AS\n SELECT\n b.concept,\n b.alt_concept,\n b.observer,\n b.verified,\n b.verifier,\n b.verification_timestamp,\n b.user_defined_key,\n i.url,\n i.width,\n i.height,\n i.submitter,\n i.[timestamp],\n i.contributors_email AS image_contributors_email,\n u.contributors_email AS upload_contributors_email,\n dc.owner_institution_code,\n dc.institution_code,\n dc.rights_holder,\n dc.collection_code,\n dc.collection_id,\n dc.dataset_name\n FROM\n dbo.darwin_cores dc LEFT JOIN\n dbo.image_set_uploads u ON dc.id = u.darwincore_id LEFT JOIN\n dbo.image_uploads_join j ON j.imagesetupload_id = u.id LEFT JOIN\n dbo.images i ON j.image_id = i.id LEFT JOIN\n dbo.bounding_boxes b ON b.image_id = i.id\n ;\n\n First generate the observation from the prompt and how will you generate thq query, then only generate the prompt. Make sure the sql query is inside ```\n If the prompt is asking about species or images of individual species, draft the sql in such a way that it generates json array containing the species data. Species data must contain species concept and bounding box id as id.\n\n Prompt: Provide me few images of Asterias rubens, Acanthaster planci, Linckia laevigata, Protoreaster nodosus, Pycnopodia helianthoides\n"}, {"role": "assistant", "content": "Observation:You need to find the images from the database so you need to format the output such that it is a json and has species array that has species concept as concept, image url as url, image id as image_id and species bounding box id as id\nSince there may be many images in the database and the image count is not provided, you will search for only 5 images\nYou will search for the species in bounding boxes table with provided concepts and format it such that it has species id, image url, image_id and concept\nSql Query:```SELECT TOP 5\n i.url AS url,\n b.concept AS concept,\n b.id as id,\n b.image_id as image_id\nFROM \n dbo.bounding_boxes AS b\nJOIN \n dbo.images AS i ON b.image_id = i.id\nWHERE \n b.concept IN ('Asterias rubens', 'Acanthaster planci', 'Linckia laevigata', 'Protoreaster nodosus', 'Pycnopodia helianthoides')\nFOR JSON PATH```"}]}
{"messages": [{"role": "system", "content": "You are a text-to-sql generator. You have a database of marine species. The sql should be generated in a way such that the response from sql is a json. "}, {"role": "user", "content": "\n The database has the following structure.\n\n CREATE TABLE \"dbo\".\"bounding_box_comments\" (\n \"id\" \tbigint NOT NULL,\n \"bounding_box_uuid\" \tuniqueidentifier NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"email\" \tvarchar(254) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"text\" \tvarchar(2048) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"alternate_concept\" \tvarchar(255) NULL,\n \"flagged\" \tbit NULL,\n CONSTRAINT \"PK__bounding__3213E83F71625CCD\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"bounding_boxes\" (\n \"id\" \tbigint NOT NULL,\n \"concept\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"group_of\" \tbit NULL,\n \"height\" \tint NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"observer\" \tvarchar(256) NULL,\n \"occluded\" \tbit NULL,\n \"truncated\" \tbit NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"verification_timestamp\"\tdatetimeoffset(6) NULL,\n \"verified\" \tbit NULL,\n \"verifier\" \tvarchar(256) NULL,\n \"width\" \tint NULL,\n \"x\" \tint NULL,\n \"y\" \tint NULL,\n \"image_id\" \tbigint NULL,\n \"alt_concept\" \tvarchar(255) NULL,\n \"user_defined_key\" \tvarchar(56) NULL,\n CONSTRAINT \"PK__bounding__3213E83F3E4C2D08\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"bounding_boxes_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"concept\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"group_of\" \tbit NULL,\n \"height\" \tint NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"observer\" \tvarchar(256) NULL,\n \"occluded\" \tbit NULL,\n \"truncated\" \tbit NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"verification_timestamp\"\tdatetimeoffset(6) NULL,\n \"verified\" \tbit NULL,\n \"verifier\" \tvarchar(256) NULL,\n \"width\" \tint NULL,\n \"x\" \tint NULL,\n \"y\" \tint NULL,\n \"image_id\" \tbigint NULL,\n \"alt_concept\" \tvarchar(255) NULL,\n \"user_defined_key\" \tvarchar(56) NULL,\n CONSTRAINT \"PK__bounding__BE3894F99D30F28A\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"darwin_cores\" (\n \"id\" \tbigint NOT NULL,\n \"access_rights\" \tvarchar(1024) NULL,\n \"basis_of_record\" \tvarchar(64) NULL,\n \"bibliographic_citation\"\tvarchar(512) NULL,\n \"collection_code\" \tvarchar(64) NULL,\n \"collection_id\" \tvarchar(2048) NULL,\n \"data_generalizations\" \tvarchar(512) NULL,\n \"dataset_id\" \tuniqueidentifier NULL,\n \"dataset_name\" \tvarchar(255) NULL,\n \"dynamic_properties\" \tvarchar(2048) NULL,\n \"information_withheld\" \tvarchar(255) NULL,\n \"institution_code\" \tvarchar(255) NULL,\n \"institution_id\" \tvarchar(255) NULL,\n \"license\" \tvarchar(2048) NULL,\n \"modified\" \tdatetimeoffset(6) NULL,\n \"owner_institution_code\"\tvarchar(255) NULL,\n \"record_language\" \tvarchar(35) NULL,\n \"record_references\" \tvarchar(2048) NULL,\n \"record_type\" \tvarchar(32) NULL,\n \"rights_holder\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"image_set_upload_id\" \tbigint NULL,\n CONSTRAINT \"PK__darwin_c__3213E83F92DAE497\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"fathomnet_identities\" (\n \"id\" \tbigint NOT NULL,\n \"api_key\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"disabled\" \tbit NULL,\n \"display_name\" \tvarchar(255) NULL,\n \"email\" \tvarchar(255) NULL,\n \"expertise_rank\" \tvarchar(32) NULL,\n \"firebase_uid\" \tvarchar(255) NULL,\n \"job_title\" \tvarchar(255) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"organization\" \tvarchar(255) NULL,\n \"profile\" \tvarchar(1024) NULL,\n \"role_data\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"avatar_url\" \tvarchar(2000) NULL,\n \"orcid\" \tvarchar(32) NULL,\n \"notification_frequency\"\tvarchar(32) NULL,\n CONSTRAINT \"PK__fathomne__3213E83F59FE1468\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"fathomnet_identities_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"api_key\" \tvarchar(255) NULL,\n \"avatar_url\" \tvarchar(2000) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"disabled\" \tbit NULL,\n \"display_name\" \tvarchar(255) NULL,\n \"email\" \tvarchar(254) NULL,\n \"expertise_rank\" \tvarchar(32) NULL,\n \"firebase_uid\" \tvarchar(64) NULL,\n \"job_title\" \tvarchar(255) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"orcid\" \tvarchar(32) NULL,\n \"organization\" \tvarchar(255) NULL,\n \"profile\" \tvarchar(1024) NULL,\n \"role_data\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"notification_frequency\"\tvarchar(32) NULL,\n CONSTRAINT \"PK__fathomne__BE3894F9CD98EF78\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"followed_topics\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"email\" \tvarchar(254) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"notification\" \tbit NULL,\n \"target\" \tvarchar(256) NULL,\n \"topic\" \tvarchar(32) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n CONSTRAINT \"PK__followed__3213E83F4A1EA9E0\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"image_set_uploads\" (\n \"id\" \tbigint NOT NULL,\n \"contributors_email\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"format\" \tvarchar(255) NULL,\n \"last_updated_timestamp\" \tdatetime2(6) NULL,\n \"local_path\" \tvarchar(2048) NULL,\n \"rejection_details\" \tvarchar(255) NULL,\n \"rejection_reason\" \tvarchar(255) NULL,\n \"remote_uri\" \tvarchar(2048) NULL,\n \"sha256\" \tvarchar(64) NULL,\n \"status\" \tvarchar(255) NULL,\n \"status_update_timestamp\"\tdatetimeoffset(6) NULL,\n \"status_updater_email\" \tvarchar(254) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"darwincore_id\" \tbigint NULL,\n CONSTRAINT \"PK__image_se__3213E83F9C72A0E9\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"image_uploads_join\" (\n \"imagesetupload_id\"\tbigint NOT NULL,\n \"image_id\" \tbigint NOT NULL,\n CONSTRAINT \"PK__image_up__8A53EE0EBD9D776A\" PRIMARY KEY CLUSTERED(\"imagesetupload_id\",\"image_id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"images\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"depth_meters\" \tfloat NULL,\n \"height\" \tint NULL,\n \"imaging_type\" \tvarchar(64) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"last_validation\" \tdatetimeoffset(6) NULL,\n \"latitude\" \tfloat NULL,\n \"longitude\" \tfloat NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"modified\" \tdatetimeoffset(6) NULL,\n \"sha256\" \tvarchar(64) NULL,\n \"submitter\" \tvarchar(255) NULL,\n \"timestamp\" \tdatetimeoffset(6) NULL,\n \"url\" \tvarchar(2048) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"valid\" \tbit NULL,\n \"width\" \tint NULL,\n \"contributors_email\" \tvarchar(254) NULL,\n \"altitude\" \tfloat NULL,\n \"oxygen_ml_l\" \tfloat NULL,\n \"pressure_dbar\" \tfloat NULL,\n \"salinity\" \tfloat NULL,\n \"temperature_celsius\" \tfloat NULL,\n CONSTRAINT \"PK__images__3213E83FD76E309F\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"images_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"contributors_email\" \tvarchar(254) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"depth_meters\" \tfloat NULL,\n \"height\" \tint NULL,\n \"imaging_type\" \tvarchar(64) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"last_validation\" \tdatetimeoffset(6) NULL,\n \"latitude\" \tfloat NULL,\n \"longitude\" \tfloat NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"modified\" \tdatetimeoffset(6) NULL,\n \"sha256\" \tvarchar(64) NULL,\n \"timestamp\" \tdatetimeoffset(6) NULL,\n \"url\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"valid\" \tbit NULL,\n \"width\" \tint NULL,\n \"altitude\" \tfloat NULL,\n \"oxygen_ml_l\" \tfloat NULL,\n \"pressure_dbar\" \tfloat NULL,\n \"salinity\" \tfloat NULL,\n \"temperature_celsius\" \tfloat NULL,\n CONSTRAINT \"PK__images_a__BE3894F92DF6715C\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"marine_regions\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2 NULL,\n \"last_updated_timestamp\"\tdatetime2 NULL,\n \"max_latitude\" \tfloat NOT NULL,\n \"max_longitude\" \tfloat NOT NULL,\n \"min_latitude\" \tfloat NOT NULL,\n \"min_longitude\" \tfloat NOT NULL,\n \"mrgid\" \tbigint NULL,\n \"name\" \tvarchar(255) NULL,\n CONSTRAINT \"PK__marine_r__3213E83FE987FC8B\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"revinfo\" (\n \"rev\" \tint IDENTITY(1,1) NOT NULL,\n \"revtstmp\"\tbigint NULL,\n CONSTRAINT \"PK__revinfo__C2B7CC69D3938648\" PRIMARY KEY CLUSTERED(\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"tags\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2 NULL,\n \"tag\" \tvarchar(255) NOT NULL,\n \"last_updated_timestamp\"\tdatetime2 NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"value\" \tvarchar(255) NOT NULL,\n \"image_id\" \tbigint NULL,\n CONSTRAINT \"PK__tags__3213E83F3A490684\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"tags_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"created_timestamp\" \tdatetime2 NULL,\n \"tag\" \tvarchar(255) NULL,\n \"last_updated_timestamp\"\tdatetime2 NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"value\" \tvarchar(255) NULL,\n \"image_id\" \tbigint NULL,\n CONSTRAINT \"PK__tags_aud__BE3894F94F1608A8\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE VIEW \"dbo\".\"boundingbox_extended_info\" AS\n SELECT\n b.concept,\n b.alt_concept,\n b.observer,\n b.verified,\n b.verifier,\n b.verification_timestamp,\n b.user_defined_key,\n i.url,\n i.width,\n i.height,\n i.submitter,\n i.[timestamp],\n i.contributors_email AS image_contributors_email,\n u.contributors_email AS upload_contributors_email,\n dc.owner_institution_code,\n dc.institution_code,\n dc.rights_holder,\n dc.collection_code,\n dc.collection_id,\n dc.dataset_name\n FROM\n dbo.darwin_cores dc LEFT JOIN\n dbo.image_set_uploads u ON dc.id = u.darwincore_id LEFT JOIN\n dbo.image_uploads_join j ON j.imagesetupload_id = u.id LEFT JOIN\n dbo.images i ON j.image_id = i.id LEFT JOIN\n dbo.bounding_boxes b ON b.image_id = i.id\n ;\n\n First generate the observation from the prompt and how will you generate thq query, then only generate the prompt. Make sure the sql query is inside ```\n If the prompt is asking about species or images of individual species, draft the sql in such a way that it generates json array containing the species data. Species data must contain species concept and bounding box id as id.\n\n Prompt: How many images of Pycnopodia helianthoides are in the database\n"}, {"role": "assistant", "content": "Observation:You need to provide the total number of images of species Pycnopodia helianthoides in the database.\nSo, you will search the bounding box table that has a row with concept 'Pycnopodia helianthoides'\n\nSql Query:```SELECT COUNT(*) as TotalImages\nFROM dbo.bounding_boxes \nWHERE concept = 'Pycnopodia helianthoides';```"}]}
{"messages": [{"role": "system", "content": "You are a text-to-sql generator. You have a database of marine species. The sql should be generated in a way such that the response from sql is a json. "}, {"role": "user", "content": "\n The database has the following structure.\n\n CREATE TABLE \"dbo\".\"bounding_box_comments\" (\n \"id\" \tbigint NOT NULL,\n \"bounding_box_uuid\" \tuniqueidentifier NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"email\" \tvarchar(254) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"text\" \tvarchar(2048) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"alternate_concept\" \tvarchar(255) NULL,\n \"flagged\" \tbit NULL,\n CONSTRAINT \"PK__bounding__3213E83F71625CCD\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"bounding_boxes\" (\n \"id\" \tbigint NOT NULL,\n \"concept\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"group_of\" \tbit NULL,\n \"height\" \tint NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"observer\" \tvarchar(256) NULL,\n \"occluded\" \tbit NULL,\n \"truncated\" \tbit NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"verification_timestamp\"\tdatetimeoffset(6) NULL,\n \"verified\" \tbit NULL,\n \"verifier\" \tvarchar(256) NULL,\n \"width\" \tint NULL,\n \"x\" \tint NULL,\n \"y\" \tint NULL,\n \"image_id\" \tbigint NULL,\n \"alt_concept\" \tvarchar(255) NULL,\n \"user_defined_key\" \tvarchar(56) NULL,\n CONSTRAINT \"PK__bounding__3213E83F3E4C2D08\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"bounding_boxes_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"concept\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"group_of\" \tbit NULL,\n \"height\" \tint NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"observer\" \tvarchar(256) NULL,\n \"occluded\" \tbit NULL,\n \"truncated\" \tbit NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"verification_timestamp\"\tdatetimeoffset(6) NULL,\n \"verified\" \tbit NULL,\n \"verifier\" \tvarchar(256) NULL,\n \"width\" \tint NULL,\n \"x\" \tint NULL,\n \"y\" \tint NULL,\n \"image_id\" \tbigint NULL,\n \"alt_concept\" \tvarchar(255) NULL,\n \"user_defined_key\" \tvarchar(56) NULL,\n CONSTRAINT \"PK__bounding__BE3894F99D30F28A\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"darwin_cores\" (\n \"id\" \tbigint NOT NULL,\n \"access_rights\" \tvarchar(1024) NULL,\n \"basis_of_record\" \tvarchar(64) NULL,\n \"bibliographic_citation\"\tvarchar(512) NULL,\n \"collection_code\" \tvarchar(64) NULL,\n \"collection_id\" \tvarchar(2048) NULL,\n \"data_generalizations\" \tvarchar(512) NULL,\n \"dataset_id\" \tuniqueidentifier NULL,\n \"dataset_name\" \tvarchar(255) NULL,\n \"dynamic_properties\" \tvarchar(2048) NULL,\n \"information_withheld\" \tvarchar(255) NULL,\n \"institution_code\" \tvarchar(255) NULL,\n \"institution_id\" \tvarchar(255) NULL,\n \"license\" \tvarchar(2048) NULL,\n \"modified\" \tdatetimeoffset(6) NULL,\n \"owner_institution_code\"\tvarchar(255) NULL,\n \"record_language\" \tvarchar(35) NULL,\n \"record_references\" \tvarchar(2048) NULL,\n \"record_type\" \tvarchar(32) NULL,\n \"rights_holder\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"image_set_upload_id\" \tbigint NULL,\n CONSTRAINT \"PK__darwin_c__3213E83F92DAE497\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"fathomnet_identities\" (\n \"id\" \tbigint NOT NULL,\n \"api_key\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"disabled\" \tbit NULL,\n \"display_name\" \tvarchar(255) NULL,\n \"email\" \tvarchar(255) NULL,\n \"expertise_rank\" \tvarchar(32) NULL,\n \"firebase_uid\" \tvarchar(255) NULL,\n \"job_title\" \tvarchar(255) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"organization\" \tvarchar(255) NULL,\n \"profile\" \tvarchar(1024) NULL,\n \"role_data\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"avatar_url\" \tvarchar(2000) NULL,\n \"orcid\" \tvarchar(32) NULL,\n \"notification_frequency\"\tvarchar(32) NULL,\n CONSTRAINT \"PK__fathomne__3213E83F59FE1468\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"fathomnet_identities_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"api_key\" \tvarchar(255) NULL,\n \"avatar_url\" \tvarchar(2000) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"disabled\" \tbit NULL,\n \"display_name\" \tvarchar(255) NULL,\n \"email\" \tvarchar(254) NULL,\n \"expertise_rank\" \tvarchar(32) NULL,\n \"firebase_uid\" \tvarchar(64) NULL,\n \"job_title\" \tvarchar(255) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"orcid\" \tvarchar(32) NULL,\n \"organization\" \tvarchar(255) NULL,\n \"profile\" \tvarchar(1024) NULL,\n \"role_data\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"notification_frequency\"\tvarchar(32) NULL,\n CONSTRAINT \"PK__fathomne__BE3894F9CD98EF78\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"followed_topics\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"email\" \tvarchar(254) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"notification\" \tbit NULL,\n \"target\" \tvarchar(256) NULL,\n \"topic\" \tvarchar(32) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n CONSTRAINT \"PK__followed__3213E83F4A1EA9E0\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"image_set_uploads\" (\n \"id\" \tbigint NOT NULL,\n \"contributors_email\" \tvarchar(255) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"format\" \tvarchar(255) NULL,\n \"last_updated_timestamp\" \tdatetime2(6) NULL,\n \"local_path\" \tvarchar(2048) NULL,\n \"rejection_details\" \tvarchar(255) NULL,\n \"rejection_reason\" \tvarchar(255) NULL,\n \"remote_uri\" \tvarchar(2048) NULL,\n \"sha256\" \tvarchar(64) NULL,\n \"status\" \tvarchar(255) NULL,\n \"status_update_timestamp\"\tdatetimeoffset(6) NULL,\n \"status_updater_email\" \tvarchar(254) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"darwincore_id\" \tbigint NULL,\n CONSTRAINT \"PK__image_se__3213E83F9C72A0E9\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"image_uploads_join\" (\n \"imagesetupload_id\"\tbigint NOT NULL,\n \"image_id\" \tbigint NOT NULL,\n CONSTRAINT \"PK__image_up__8A53EE0EBD9D776A\" PRIMARY KEY CLUSTERED(\"imagesetupload_id\",\"image_id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"images\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"depth_meters\" \tfloat NULL,\n \"height\" \tint NULL,\n \"imaging_type\" \tvarchar(64) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"last_validation\" \tdatetimeoffset(6) NULL,\n \"latitude\" \tfloat NULL,\n \"longitude\" \tfloat NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"modified\" \tdatetimeoffset(6) NULL,\n \"sha256\" \tvarchar(64) NULL,\n \"submitter\" \tvarchar(255) NULL,\n \"timestamp\" \tdatetimeoffset(6) NULL,\n \"url\" \tvarchar(2048) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"valid\" \tbit NULL,\n \"width\" \tint NULL,\n \"contributors_email\" \tvarchar(254) NULL,\n \"altitude\" \tfloat NULL,\n \"oxygen_ml_l\" \tfloat NULL,\n \"pressure_dbar\" \tfloat NULL,\n \"salinity\" \tfloat NULL,\n \"temperature_celsius\" \tfloat NULL,\n CONSTRAINT \"PK__images__3213E83FD76E309F\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"images_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"contributors_email\" \tvarchar(254) NULL,\n \"created_timestamp\" \tdatetime2(6) NULL,\n \"depth_meters\" \tfloat NULL,\n \"height\" \tint NULL,\n \"imaging_type\" \tvarchar(64) NULL,\n \"last_updated_timestamp\"\tdatetime2(6) NULL,\n \"last_validation\" \tdatetimeoffset(6) NULL,\n \"latitude\" \tfloat NULL,\n \"longitude\" \tfloat NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"modified\" \tdatetimeoffset(6) NULL,\n \"sha256\" \tvarchar(64) NULL,\n \"timestamp\" \tdatetimeoffset(6) NULL,\n \"url\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"valid\" \tbit NULL,\n \"width\" \tint NULL,\n \"altitude\" \tfloat NULL,\n \"oxygen_ml_l\" \tfloat NULL,\n \"pressure_dbar\" \tfloat NULL,\n \"salinity\" \tfloat NULL,\n \"temperature_celsius\" \tfloat NULL,\n CONSTRAINT \"PK__images_a__BE3894F92DF6715C\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"marine_regions\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2 NULL,\n \"last_updated_timestamp\"\tdatetime2 NULL,\n \"max_latitude\" \tfloat NOT NULL,\n \"max_longitude\" \tfloat NOT NULL,\n \"min_latitude\" \tfloat NOT NULL,\n \"min_longitude\" \tfloat NOT NULL,\n \"mrgid\" \tbigint NULL,\n \"name\" \tvarchar(255) NULL,\n CONSTRAINT \"PK__marine_r__3213E83FE987FC8B\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"revinfo\" (\n \"rev\" \tint IDENTITY(1,1) NOT NULL,\n \"revtstmp\"\tbigint NULL,\n CONSTRAINT \"PK__revinfo__C2B7CC69D3938648\" PRIMARY KEY CLUSTERED(\"rev\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"tags\" (\n \"id\" \tbigint NOT NULL,\n \"created_timestamp\" \tdatetime2 NULL,\n \"tag\" \tvarchar(255) NOT NULL,\n \"last_updated_timestamp\"\tdatetime2 NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NOT NULL,\n \"value\" \tvarchar(255) NOT NULL,\n \"image_id\" \tbigint NULL,\n CONSTRAINT \"PK__tags__3213E83F3A490684\" PRIMARY KEY CLUSTERED(\"id\")\n ON [PRIMARY]);\n CREATE TABLE \"dbo\".\"tags_aud\" (\n \"id\" \tbigint NOT NULL,\n \"rev\" \tint NOT NULL,\n \"revtype\" \tsmallint NULL,\n \"created_timestamp\" \tdatetime2 NULL,\n \"tag\" \tvarchar(255) NULL,\n \"last_updated_timestamp\"\tdatetime2 NULL,\n \"media_type\" \tvarchar(255) NULL,\n \"uuid\" \tuniqueidentifier NULL,\n \"value\" \tvarchar(255) NULL,\n \"image_id\" \tbigint NULL,\n CONSTRAINT \"PK__tags_aud__BE3894F94F1608A8\" PRIMARY KEY CLUSTERED(\"id\",\"rev\")\n ON [PRIMARY]);\n CREATE VIEW \"dbo\".\"boundingbox_extended_info\" AS\n SELECT\n b.concept,\n b.alt_concept,\n b.observer,\n b.verified,\n b.verifier,\n b.verification_timestamp,\n b.user_defined_key,\n i.url,\n i.width,\n i.height,\n i.submitter,\n i.[timestamp],\n i.contributors_email AS image_contributors_email,\n u.contributors_email AS upload_contributors_email,\n dc.owner_institution_code,\n dc.institution_code,\n dc.rights_holder,\n dc.collection_code,\n dc.collection_id,\n dc.dataset_name\n FROM\n dbo.darwin_cores dc LEFT JOIN\n dbo.image_set_uploads u ON dc.id = u.darwincore_id LEFT JOIN\n dbo.image_uploads_join j ON j.imagesetupload_id = u.id LEFT JOIN\n dbo.images i ON j.image_id = i.id LEFT JOIN\n dbo.bounding_boxes b ON b.image_id = i.id\n ;\n\n First generate the observation from the prompt and how will you generate thq query, then only generate the prompt. Make sure the sql query is inside ```\n If the prompt is asking about species or images of individual species, draft the sql in such a way that it generates json array containing the species data. Species data must contain species concept and bounding box id as id.\n\n Prompt: Find me some images that has Acanthaster planci, Chrysaora fuscescens and Siphonophorae\n"}, {"role": "assistant", "content": "Observation:You need to find the images from the database so you need to format the output such that it is a json and has species array that has species concept as concept, image url as url, image id as image_id and species bounding box id as id\nAlso in this query asks for image that has many species within a single image, it would be better to include bounding box detail(x, y, width, height) of species\nSo, you will first find out the image that contains all the three species. Also, since there may be many images in the database and the image count is not provided, you will search for only 5 images. Once you get that data, you will format the result such that it is a json array with species id, image url, image_id and concept\n\nSql Query:```WITH ImageConcepts AS (\n SELECT TOP 5 i.id as image_id\n FROM dbo.images i\n JOIN dbo.bounding_boxes b ON i.id = b.image_id\n WHERE b.concept IN ('Aurelia aurita', 'Chrysaora fuscescens', 'Siphonophorae')\n GROUP BY i.id\n HAVING COUNT(DISTINCT b.concept) = 3\n)\nSELECT \n b.id,\n b.concept,\n i.url,\n i.id as image_id,\n b.x,\n b.y,\n b.width,\n b.height\nFROM \n dbo.images i\nJOIN \n dbo.bounding_boxes b ON i.id = b.image_id\nJOIN \n ImageConcepts c ON c.image_id = i.id\nWHERE \n b.concept IN ('Aurelia aurita', 'Chrysaora fuscescens', 'Siphonophorae')\nFOR JSON PATH```"}]}