Just a few notes while making changes to the docs,
-
In cases of arguments which are passed as queries such as the
models
param in/endpoints
, thename
argument in/dataset
and so on, the params are defined using theQuery
class so the value used in theexample
is the value used in the docs. For e.g. this is where the example value for the key argument used in the/custom_api_key
endpoint is specified -
In cases of arguments which are passed as the body of the request such as all the arguments passed to
/chat/completions
or the arguments passed as form data such as with the/dataset
upload endpoints, the example values are defined as the”example”
key of thejson_schema_extra
parameter passed to theField
object. This may either be as part of the schema (as in case of the /chat/completions endpoint) or defined in the view signature itself (as in case of the /dataset upload endpoint. -
In both of the above cases,
description
,default
, etc. can be modified through the same places as keyword arguments. Ofc for the endpoints where we pass body, description and default would be in the call of theField
/Form
class itself rather than inside thejson_schema_extra
-
The error details are picked from the
responses
in the view function (e.g. here and the description of the endpoint itself is picked from the docstring of the view function (e.g. here) -
There’s some exceptions for endpoints like
/endpoints
where you need to either specify themodel
or theprovider
(and others where certain arguments are optional), I have basically hardcoded to either of the 2 in terms of the example itself and ignored the other one, but making changes to that required making changes to the script here -
If you add an endpoint which accepts a file upload, this dict would need changing to include that argument name there (because those arguments are passed as form-data rather than json-data in the request)
-
The
/chat/completions
endpoint arguments have been grouped into 3 categories as explained here. This grouping is applied to the API reference page using a mapping like this. In order to add more sections or edit existing sections, you'd basically need to add the argument above which the header should be added along with the link to that section. -
The headers for the sections under the API reference page are picked from the tags specified here. The title of the pages themselves are picked from the openapi spec's
summary
. -
Some of the formatting is fairly sensitive so I’d suggest going through their docs to understand how stuff is formatted. For e.g. having multi-line strings like this wouldn’t work but it would need to be written like this (with the triple back-tick)
-
Also any descriptions of the form
<model>
,<model>@<provider>
, etc. get treated as html elements in an mdx file so ideally it should be\<model\>
,\<model\>\<provider\>
, etc. -
There's also formatting issues like this where
{ "type": "json_object" }
without the back-ticks wouldn't work. Also the{
and the"
is necessary on both sides. -
Same applies to code blocks like this which should also be enclosed with triple quotes like this to avoid parsing errors.
-
There are a few endpoints on the docs where either the description of the parameters or the description of the responses with different error codes might be missing, adding those to the above mentioned places should get them working.
-
Finally, given that we’re doing the markdown writing ourselves rather than relying on mintlify, this has lead to some brittleness with the doc building code, so I’d highly recommend setting up the docs locally, which would require
- cloning the
unify-docs
repo, followed bynpm i -g mintlify
(also prolly installingnpm
andnode
if not done already), then go inside theunify-docs
folder and donpm i
followed bymintlify dev
. This should run the docs on a local server where you can test how your changes - Copy over the
mint.json
from the latest version ofunify-docs
inside theunify
folder - in order to build the docs, you’d need to go inside the orchestra folder and do
python docs/main.py
which should build the mdx files, you’d then need to move theapi-reference
folder and replace theunify-docs/api-reference
folder with that one instead, and also replace the updatedmint.json
in theunify-doc
s folder. This should give you a preview of how your changes impacted the docs
OR
- Go through the README.md and set things up with
docker
- cloning the
-
As far as the python client docs go, you would need to
- Clone the
unify
repo - Install
pydoc-markdown
- Create a folder named
output
- run the command
pydoc-markdown | tee output/result.txt
- Then you should move the
generate_docs.py
script inside theoutput
folder - Run
python output/generate_docs.py
- Once the script is complete, you can copy the
.mdx
files inside theoutput
folder inside thepython
folder of theunify-docs
repo.
- Clone the
-
In case there's a submodule in the python client that docs shouldn't be built for, that submodule should be added to this list.