Skip to content

(POC) Using GraphQL for declared metric endpoints #355

@jankrepl

Description

@jankrepl

Problem statement

We have had numerous discussions about how the response body of the declared endpoints should look like.

  • If one makes it too small, important info can be missing.
  • If one makes it too big, the LLM might be overwhelmed.

Realistically, it is impossible to have a one size fits all schema.

Past solutions

This PR tried to (partially) recreate a GraphQL behavior inside of a REST endpoint: #339. Which is fair. However, IMO it is not general enough.

Specific usecases + why better

  • One can decide whether to get a full list of items [2.5, 9, 1, ..., 17] or just the some statistic (sum, mean, std, ...)
  • Requesting only specific keys of nested objects
  • The neuroagent would have to inspect the GraphQL schema via the inspection logic (it would not be part of the OpenAPI spec)
  • LLMs will be very good at writing custom GraphQL queries since it is a very popular technology

Implementation guidelines

  • How to integrate https://fastapi.tiangolo.com/how-to/graphql/
  • At first, we should maybe just do an experimental new endpoint to see how it works. And only if it works well and clearly improves the REST approach we would use it in all the other declared endpoints.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions