Sage-Bionetworks / sage-monorepo

Where OpenChallenges, Schematic, and other Sage open source apps are built
https://sage-bionetworks.github.io/sage-monorepo/
Apache License 2.0
21 stars 12 forks source link

[Epic] Explore the creation of OC GPT #2466

Closed tschaffter closed 5 months ago

tschaffter commented 5 months ago

What product(s) is this story for?

OpenChallenges

As a user, I want

No response

Description

Actions: OpenChallenges REST API

Errors:

None of the provided servers is under the root origin https://localhost
Server URL http://localhost/v1 is not under the root origin https://localhost; ignoring it
In context=('components', 'schemas', 'EmptyObject'), object schema missing properties
In context=('components', 'schemas', 'ChallengePlatformsPage'), object schema missing properties
In context=('components', 'schemas', 'ChallengeInputDataTypesPage'), object schema missing properties
In context=('components', 'schemas', 'ChallengeContributionsPage'), object schema missing properties
In context=('components', 'schemas', 'OrganizationsPage'), object schema missing properties
In context=('components', 'schemas', 'UsersPage'), object schema missing properties
In context=('components', 'schemas', 'ChallengesPage'), object schema missing properties
In path /challenges, method get, operationId listChallenges, parameter {'$ref': '#/components/parameters/challengeSearchQuery'} is has missing or non-string name; skipping
In context=('paths', '/challenges', '200', 'response', 'content', 'application/json', 'schema'), reference to unknown component ChallengesPage; using empty schema
In path /challenges, method get, operationId listChallenges, skipping function due to errors
Path /challenges/{challengeId} has unrecognized method parameters; skipping
Path /challenges/{challengeId}/contributions has unrecognized method parameters; skipping
In context=('paths', '/challenges/{challengeId}/contributions', '200', 'response', 'content', 'application/json', 'schema'), reference to unknown component ChallengeContributionsPage; using empty schema
In path /challengeInputDataTypes, method get, operationId listChallengeInputDataTypes, parameter {'$ref': '#/components/parameters/challengeInputDataTypeSearchQuery'} is has missing or non-string name; skipping
In context=('paths', '/challengeInputDataTypes', '200', 'response', 'content', 'application/json', 'schema'), reference to unknown component ChallengeInputDataTypesPage; using empty schema
In path /challengeInputDataTypes, method get, operationId listChallengeInputDataTypes, skipping function due to errors
In path /challengePlatforms, method get, operationId listChallengePlatforms, parameter {'$ref': '#/components/parameters/challengePlatformSearchQuery'} is has missing or non-string name; skipping
In context=('paths', '/challengePlatforms', '200', 'response', 'content', 'application/json', 'schema'), reference to unknown component ChallengePlatformsPage; using empty schema
In path /challengePlatforms, method get, operationId listChallengePlatforms, skipping function due to errors
Path /challengePlatforms/{challengePlatformName} has unrecognized method parameters; skipping
In path /images, method get, operationId getImage, parameter {'$ref': '#/components/parameters/imageQuery'} is has missing or non-string name; skipping
In path /images, method get, operationId getImage, skipping function due to errors
In path /organizations, method get, operationId listOrganizations, parameter {'$ref': '#/components/parameters/organizationSearchQuery'} is has missing or non-string name; skipping
In context=('paths', '/organizations', '200', 'response', 'content', 'application/json', 'schema'), reference to unknown component OrganizationsPage; using empty schema
In path /organizations, method get, operationId listOrganizations, skipping function due to errors
Path /organizations/{org} has unrecognized method parameters; skipping
In path /users, method get, operationId listUsers, parameter {'$ref': '#/components/parameters/pageNumber'} is has missing or non-string name; skipping
In path /users, method get, operationId listUsers, parameter {'$ref': '#/components/parameters/pageSize'} is has missing or non-string name; skipping
In context=('paths', '/users', '200', 'response', 'content', 'application/json', 'schema'), reference to unknown component UsersPage; using empty schema
In path /users, method get, operationId listUsers, skipping function due to errors
Path /users/{userId} has unrecognized method parameters; skipping
In context=('paths', '/users/{userId}', '200', 'response', 'content', 'application/json', 'schema'), reference to unknown component EmptyObject; using empty schema

Acceptance criteria

No response

Tasks

No response

Anything else?

No response

Have you linked this story to a GitHub Project?

tschaffter commented 5 months ago

To solve the server error, set it to https://openchallenges.io/api/v1

tschaffter commented 5 months ago

Error: object schema missing properties

This error happens for EmptyObject because it indeed doesn't have properties.

This error also show for ChallengePlatformsPage:

    ChallengePlatformsPage:
      type: object
      description: A page of challenge platforms.
      allOf:
        - $ref: "#/components/schemas/PageMetadata"
        - type: object
          properties:
            challengePlatforms:
              description: A list of challenge platforms.
              type: array
              items:
                $ref: "#/components/schemas/ChallengePlatform"
          required:
            - challengePlatforms
      x-java-class-annotations:
        - "@lombok.Builder"
tschaffter commented 5 months ago

Error: parameter {'$ref': '#/components/parameters/challengeSearchQuery'} is has missing or non-string name; skipping

According to this thread, GPT does not support reference to parameters.

I’m also running into this issue, references to parameters don’t work. References to schemas and also responses work fine.

In path /challenges, method get, operationId listChallenges, parameter {'$ref': '#/components/parameters/challengeSearchQuery'} is has missing or non-string name; skipping
paths:
  /challenges:
    get:
      tags:
        - Challenge
      summary: List challenges
      description: List challenges
      operationId: listChallenges
      parameters:
        - $ref: "#/components/parameters/challengeSearchQuery"
  parameters:
    challengeSearchQuery:
      name: challengeSearchQuery
      description: The search query used to find challenges.
      in: query
      schema:
        $ref: "#/components/schemas/ChallengeSearchQuery"
tschaffter commented 5 months ago

Error: reference to unknown component ChallengesPage; using empty schema

The component ChallengesPage does not include properties but an allOf (see above).

In context=('paths', '/challenges', '200', 'response', 'content', 'application/json', 'schema'), reference to unknown component ChallengesPage; using empty schema
tschaffter commented 5 months ago

Error: Path /challenges/{challengeId} has unrecognized method parameters; skipping

Same reason as an issue above: GPT does not support references for parameters.

  /challenges/{challengeId}:
    parameters:
      - $ref: "#/components/parameters/challengeId"
tschaffter commented 5 months ago

About page size

The default value of 100 led to an error about the response being to large.

GPT takes some times to fetch multiple pages. For each page, GPT will display a message "Talk to ...".

image
tschaffter commented 5 months ago

Retrieving the total number of elements from a paginated response

Pages returned by OC include the property totalElements. GPT can retrieve this information by fetching only a one page.

User How many challenges are on OpenChallenges?

GPT There are currently 491 challenges listed in the OpenChallenges database.

tschaffter commented 5 months ago

Limitation: GPT won't show the raw reponse

User Can you show me the raw response for the preview request you made?

GPT I'm sorry, but I cannot display the raw response of the previous request due to a system limitation. The data retrieval process is designed to provide summarized information rather than raw data outputs. If you have specific queries about challenges on Synapse or any other platform, feel free to ask, and I'll do my best to provide the information within these constraints.