sdks/code_generation/fern/README.md
For either the automatic script or the manual steps:
This is a one time process in the local machine generating the code.
[!IMPORTANT] You should generally run this script instead of manual steps below. The only pre-requirement is installing the fern SDK.
The following script automates this whole process:
./scripts/generate_openapi.sh
You simply need to run it from the repository base directory.
These are the manual steps (not recommended), as alternative to the automatic script. In this case, it's also a pre-requirement to install the fern SDK. Steps:
Run Opik locally using ./opik.sh.
Go to http://localhost:3003/ (URL for backend API specification)
Download openapi specification file - openapi.yaml
Put this file into code_generation/fern/openapi/openapi.yaml (overwrite it).
Note that this path contains the version of the schema from which the code in src/opik/rest_api for the SDK was generated. Therefore, it might not be the latest version of the schema.
Run fern generate from inside code_generation/fern folder. This will generate a python code inside the directory called sdks near the fern one.
Replace content of src/opik/rest_api with the python package inside sdks (there will be few nested directories, navigate until you find python files)
Run git diff --name-only | xargs pre-commit run --files to format only changed files