Skip to main content

OpenAPI

OpenAPI code generator generates LLM tools from OpenAPI specs. The whole OpenAPI spec is converted to a toolkit. Each operation is the OpenAPI spec is converted to a tool in this toolkit. Information of a tool is extracted from the OpenAPI spec.

Source code can be generated using CLI. Below are some examples.

Examples

Canada Holidays

info

This is an example of using public APIs without authentication.

The Canada Holidays API lists all 30 public holidays for all 13 provinces and territories in Canada, including federal holidays.

Source code can be generated using the following command.

Generate code
java -jar code-generator-cli.jar openapi \
--output=target/canada-holidays \
--artifact-id=canada-holidays --artifact-version=0.1.0 \
--package-name=com.javaaidev.easyllmtools.tools.canadaholidays \
canada-holidays.openapi.json

Generated source code is a Maven project. Install this project to use this tool.

Install Maven project
mvn -B -ntp -f target/canada-holidays/pom.xml install

NYTimes Top Stories

info

This is an example of using public APIs using API keys.

The Top Stories API provides lists of articles and associated images by section.

Source code can be generated using the following command.

Generate code
java -jar target/code-generator-cli.jar openapi \
--output=target/nytimes \
--artifact-id=nytimes --artifact-version=0.1.0 \
--package-name=com.javaaidev.easyllmtools.tools.nytimes \
nytimes-top_stories.json

Generated source code is a Maven project. Install this project to use this tool.

Install Maven project
mvn -B -ntp -f target/nytimes/pom.xml install