leptos/projects/openapi-openai-api-swagger-ui
Ben Wishovich c676cf921d Make get_configuration sync (#2647)
* Made get_configuraiton sync

* Update examples
2024-08-01 19:42:49 -04:00
..
end2end projects: OpenAPI Utopia (#2556) 2024-05-06 08:48:09 -04:00
public projects: OpenAPI Utopia (#2556) 2024-05-06 08:48:09 -04:00
src Make get_configuration sync (#2647) 2024-08-01 19:42:49 -04:00
style projects: OpenAPI Utopia (#2556) 2024-05-06 08:48:09 -04:00
.gitignore projects: OpenAPI Utopia (#2556) 2024-05-06 08:48:09 -04:00
Cargo.toml projects: OpenAPI Utopia (#2556) 2024-05-06 08:48:09 -04:00
LICENSE projects: OpenAPI Utopia (#2556) 2024-05-06 08:48:09 -04:00
README.md projects: OpenAPI Utopia (#2556) 2024-05-06 08:48:09 -04:00
rust-toolchain.toml projects: OpenAPI Utopia (#2556) 2024-05-06 08:48:09 -04:00

#OpenAPI Swagger-Ui OpenAI GPT

This example shows how to document server functions via OpenAPI schema generated using Utoipa and serve the swagger ui via /swagger-ui endpoint. More than that, this example shows how to take said OpenAPI spec and turn it into a function list to feed to OpenAI's chat completion endpoint to generate the JSON values to feed back into our server functions.

The example shows an input and if you tell it to do something that is covered, say hello, or generate a list of names it will do that.

To use the AI part of this project provide your openAPI key in an environment variable when running cargo leptos.

OPENAI_API_KEY=my_secret_key cargo leptos serve

Thoughts, Feedback, Criticism, Comments?

Send me any of the above, I'm @sjud on leptos discord. I'm always looking to improve and make these projects more helpful for the community. So please let me know how I can do that. Thanks!