- what this is
- install openapi generator cli
- making changes to the inference server
- making changes to the autointerp server
neuronpedia's services has a webapp (nextjs) in typescript and separate python servers for inference and autointerp. to ensure that our servers communicate with each other in a predictable and typesafe manner, the requests to the inference and autointerp servers are defined by openapi schemas.
having openapi schemas allows us to use openapi client generators to automatically create clients that make and parse requests.
this readme documents how to update the schemas and re-generate clients when we want to make additions or changes to the api.
install the openapi generator cli here.
here's how to create or update an endpoint in the inference server.
- spec out your new addition(s) or change(s) under openapi/inference-server.yaml and the openapi/inference subdirectory. for example, you might create a new endpoint under openapi/inference/paths, then add that new endpoint path to the
inference-server.yamlfile - run the command, replacing
BUMPED_SEMANTIC_VERSIONmake setup-all-inference VERSION=BUMPED_SEMANTIC_VERSION - update the code under apps/inference/neuronpedia_inference for your changes. for example, if you were creating a new endpoint of
POST [host]/v1/util/action, you would create a newaction.pyfile under apps/inference/neuronpedia_inference/util. - update your webapp code, starting by changing ../apps/webapp/lib/utils/inference.ts to use the new/updated endpoints in the
neuronpedia-inference-client - bring up the webapp and inference server locally (see the main readme for running dev instances), and test the calls between the two servers.
- once you're satisfied with the results, commit all your changes.
- [highly encouraged] make a PR to the official neuronpedia repo and we'll review it ASAP!
the instructions are mostly the same as making changes to the inference server, except names are changed from neuronpedia-inference to neuronpedia-autointerp, etc.
- spec out your new addition(s) or change(s) under openapi/autointerp-server.yaml and the openapi/autointerp subdirectory.
- run the command, replacing
BUMPED_SEMANTIC_VERSIONmake setup-all-autointerp VERSION=BUMPED_SEMANTIC_VERSION - update the code under apps/autointerp/neuronpedia_autointerp for your changes.
- update your webapp code, starting by changing ../apps/webapp/lib/utils/autointerp.ts to use the new/updated endpoints in the
neuronpedia-autointerp-client - bring up the webapp and autointerp server locally (see the main readme for running dev instances), and test the calls between the two servers.
- once you're satisfied with the results, commit all your changes.
- [highly encouraged] make a PR to the official neuronpedia repo and we'll review it ASAP!