I’m seeing a weird behavior in developing a plugin for a small API (which makes calls to a larger more complex API, though I don’t think that’s relevant). I have three endpoints, and the model calls two of the 3 successfully, but almost never the third. I say almost, because I have seen it happen, but only a couple times and I wasn’t able to replicate.
I’m not sure how to debug, because according to my server logs the request is never made, even though the UI says it tried to use the plugin and failed. Here’s a couple of screenshots, first the question that triggers two API calls, successfully (I’ve not shown the result of the second call, it’s longer):
And the followup question in the UI triggering the third endpoint that fails:
My server logs:
NFO: 127.0.0.1:50762 - "GET /openapi.json HTTP/1.1" 200 OK
INFO: 127.0.0.1:50766 - "OPTIONS /search/entity/Marfan%20syndrome HTTP/1.1" 200 OK
{'results': [SearchResultItem(id='MONDO:0007947', synonyms=["Marfan's syndrome", 'MFS1', 'Marfan Syndrome, Type 1', 'Marfan syndrome type 1', 'MARFAN SYNDROME; MFS', 'MFS', 'Marfan syndrome', 'Marfan syndrome, type 1']), SearchResultItem(id='OMIA:000628', synonyms=[])]}
INFO: 127.0.0.1:50766 - "GET /search/entity/Marfan%20syndrome HTTP/1.1" 200 OK
INFO: 127.0.0.1:50770 - "OPTIONS /bioentity/disease/MONDO%3A0007947/phenotypes HTTP/1.1" 200 OK
INFO: 127.0.0.1:50770 - "GET /bioentity/disease/MONDO%3A0007947/phenotypes HTTP/1.1" 200 OK
And here’s the openapi.yaml spec:
---
openapi: 3.0.2
info:
title: FastAPI
version: 0.1.0
paths:
"/search/entity/{term}":
get:
summary: Search for entities in the Monarch knowledge graph
description: Search for entities in the Monarch knowledge graph
operationId: search_entity
parameters:
- required: true
schema:
title: Term
type: string
name: term
in: path
- description: The category to search within.
required: false
schema:
title: Category
type: array
items:
type: string
description: The category to search within.
default:
- disease
name: category
in: query
- description: The maximum number of search results to return.
required: false
schema:
title: Rows
type: integer
description: The maximum number of search results to return.
default: 2
name: rows
in: query
responses:
'200':
description: Search results for the given ontology term
content:
application/json:
schema:
"$ref": "#/components/schemas/SearchResultResponse"
'422':
description: Validation Error
content:
application/json:
schema:
"$ref": "#/components/schemas/HTTPValidationError"
"/bioentity/disease/{id}/phenotypes":
get:
summary: Get phenotypes associated with disease
description: Get phenotypes associated with disease
operationId: get_disease_phenotype_associations
parameters:
- required: true
schema:
title: Id
type: string
name: id
in: path
- required: false
schema:
title: Rows
type: integer
default: 10
name: rows
in: query
- required: false
schema:
title: Unselect Evidence
type: boolean
default: true
name: unselect_evidence
in: query
responses:
'200':
description: Phenotypes associated with disease
content:
application/json:
schema:
"$ref": "#/components/schemas/PhenotypeAssociationResponse"
'422':
description: Validation Error
content:
application/json:
schema:
"$ref": "#/components/schemas/HTTPValidationError"
"/bioentity/disease/{id}/genes":
get:
summary: Get gene information for a disease
description: Get gene information for a disease
operationId: get_disease_gene_associations
parameters:
- required: true
schema:
title: Id
type: string
name: id
in: path
- required: false
schema:
title: Max Results
type: integer
default: 10
name: max_results
in: query
- required: false
schema:
allOf:
- "$ref": "#/components/schemas/AssociationType"
default: both
name: association_type
in: query
responses:
'200':
description: Gene information for a disease
content:
application/json:
schema:
"$ref": "#/components/schemas/GeneInfoResponse"
'422':
description: Validation Error
content:
application/json:
schema:
"$ref": "#/components/schemas/HTTPValidationError"
"/bioentity/gene/{id}/phenotypes":
get:
summary: Get phenotypes associated with gene
description: Get phenotypes associated with gene
operationId: get_gene_phenotype_associations
parameters:
- required: true
schema:
title: Id
type: string
name: id
in: path
- required: false
schema:
title: Rows
type: integer
default: 4
name: rows
in: query
- required: false
schema:
title: Facet
type: boolean
default: false
name: facet
in: query
- required: false
schema:
title: Unselect Evidence
type: boolean
default: true
name: unselect_evidence
in: query
- required: false
schema:
title: Exclude Automatic Assertions
type: boolean
default: false
name: exclude_automatic_assertions
in: query
- required: false
schema:
title: Fetch Objects
type: boolean
default: false
name: fetch_objects
in: query
- required: false
schema:
title: Use Compact Associations
type: boolean
default: true
name: use_compact_associations
in: query
- required: false
schema:
title: Direct
type: boolean
default: false
name: direct
in: query
- required: false
schema:
title: Direct Taxon
type: boolean
default: false
name: direct_taxon
in: query
responses:
'200':
description: Phenotypes associated with gene
content:
application/json:
schema:
"$ref": "#/components/schemas/GenePhenotypeAssociationResponse"
'422':
description: Validation Error
content:
application/json:
schema:
"$ref": "#/components/schemas/HTTPValidationError"
components:
schemas:
AssociationType:
title: AssociationType
enum:
- causal
- non_causal
- both
type: string
description: An enumeration.
GeneInfo:
title: GeneInfo
required:
- gene_id
- gene_label
- relation_label
type: object
properties:
gene_id:
title: Gene Id
type: string
description: The ontology identifier of the gene.
gene_label:
title: Gene Label
type: string
description: The human-readable label of the gene.
relation_label:
title: Relation Label
type: string
description: The human-readable label of the relation between the gene and
the disease.
GeneInfoResponse:
title: GeneInfoResponse
required:
- genes
type: object
properties:
genes:
title: Genes
type: array
items:
"$ref": "#/components/schemas/GeneInfo"
GenePhenotypeAssociation:
title: GenePhenotypeAssociation
required:
- subject
- relation
- objects
type: object
properties:
subject:
title: Subject
type: string
description: The gene identifier.
relation:
title: Relation
type: string
description: The ontology identifier of the relation.
objects:
title: Objects
type: array
items:
type: string
description: A list of phenotype ontology identifiers associated with the
gene.
GenePhenotypeAssociationResponse:
title: GenePhenotypeAssociationResponse
required:
- compact_associations
- numFound
type: object
properties:
compact_associations:
title: Compact Associations
type: array
items:
"$ref": "#/components/schemas/GenePhenotypeAssociation"
numFound:
title: Numfound
type: integer
HTTPValidationError:
title: HTTPValidationError
type: object
properties:
detail:
title: Detail
type: array
items:
"$ref": "#/components/schemas/ValidationError"
Phenotype:
title: Phenotype
required:
- id
- label
type: object
properties:
id:
title: Id
type: string
description: The ontology identifier of the phenotype.
label:
title: Label
type: string
description: The human-readable label of the phenotype.
PhenotypeAssociation:
title: PhenotypeAssociation
required:
- id
- frequency
- onset
- phenotype
type: object
properties:
id:
title: Id
type: string
frequency:
title: Frequency
type: object
additionalProperties:
type: string
onset:
title: Onset
type: object
additionalProperties:
type: string
phenotype:
"$ref": "#/components/schemas/Phenotype"
PhenotypeAssociationResponse:
title: PhenotypeAssociationResponse
required:
- associations
- numFound
type: object
properties:
associations:
title: Associations
type: array
items:
"$ref": "#/components/schemas/PhenotypeAssociation"
numFound:
title: Numfound
type: integer
SearchResultItem:
title: SearchResultItem
required:
- id
- synonyms
type: object
properties:
id:
title: Id
type: string
description: The ontology identifier of the search result.
synonyms:
title: Synonyms
type: array
items:
type: string
description: The list of synonyms for the search result.
SearchResultResponse:
title: SearchResultResponse
required:
- results
type: object
properties:
results:
title: Results
type: array
items:
"$ref": "#/components/schemas/SearchResultItem"
description: The list of search results.
ValidationError:
title: ValidationError
required:
- loc
- msg
- type
type: object
properties:
loc:
title: Location
type: array
items:
anyOf:
- type: string
- type: integer
msg:
title: Message
type: string
type:
title: Error Type
type: string
Any ideas? Thank you!