Skip to content

Commit

Permalink
Merge pull request #16 from kestra-io/fix/function-calling-readme
Browse files Browse the repository at this point in the history
fix: fix function calling example and add readme
  • Loading branch information
anna-geller authored Jan 7, 2024
2 parents 9b8151d + 7a58184 commit 1a9fbd1
Show file tree
Hide file tree
Showing 3 changed files with 91 additions and 13 deletions.
37 changes: 37 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<!-- Thanks for submitting a Pull Request to kestra. To help us review your contribution, please follow the guidelines below:
- Make sure that your commits follow the [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) specification e.g. `feat(ui): add a new navigation menu item` or `fix(core): fix a bug in the core model` or `docs: update the README.md`. This will help us automatically generate the changelog.
- The title should briefly summarize the proposed changes.
- Provide a short overview of the change and the value it adds.
- Share a flow example to help the reviewer understand and QA the change.
- Use "close" to automatically close an issue. For example, `close #1234` will close issue #1234. -->

### What changes are being made and why?
<!-- Please include a brief summary of the changes included in this PR e.g. closes #1234. -->

---

### How the changes have been QAed?

<!-- Include example code that shows how this PR has been QAed. The code should present a complete yet easily reproducible flow.
```yaml
# Your example flow code here
```
Note that this is not a replacement for unit tests but rather a way to demonstrate how the changes work in a real-life scenario, as the end-user would experience them.
Remove this section if this change applies to all flows or to the documentation only. -->

---

### Setup Instructions

<!--If there are any setup requirements like API keys or trial accounts, kindly include brief bullet-points-description outlining the setup process below.
- [External System Documentation](URL)
- Steps to set up the necessary resources
If there are no setup requirements, you can remove this section.
Thank you for your contribution. ❤️ -->
50 changes: 44 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,56 @@
# Kestra OpenAI Plugin
<p align="center">
<a href="https://www.kestra.io">
<img src="https://kestra.io/banner.png" alt="Kestra workflow orchestrator" />
</a>
</p>

<h1 align="center" style="border-bottom: none">
Event-Driven Declarative Orchestrator
</h1>

<div align="center">
<a href="https://github.com/kestra-io/kestra/releases"><img src="https://img.shields.io/github/tag-pre/kestra-io/kestra.svg?color=blueviolet" alt="Last Version" /></a>
<a href="https://github.com/kestra-io/kestra/blob/develop/LICENSE"><img src="https://img.shields.io/github/license/kestra-io/kestra?color=blueviolet" alt="License" /></a>
<a href="https://github.com/kestra-io/kestra/stargazers"><img src="https://img.shields.io/github/stars/kestra-io/kestra?color=blueviolet&logo=github" alt="Github star" /></a> <br>
<a href="https://kestra.io"><img src="https://img.shields.io/badge/Website-kestra.io-192A4E?color=blueviolet" alt="Kestra infinitely scalable orchestration and scheduling platform"></a>
<a href="https://kestra.io/slack"><img src="https://img.shields.io/badge/Slack-Join%20Community-blueviolet?logo=slack" alt="Slack"></a>
</div>

<br />

<p align="center">
<a href="https://twitter.com/kestra_io"><img height="25" src="https://kestra.io/twitter.svg" alt="twitter" /></a> &nbsp;
<a href="https://www.linkedin.com/company/kestra/"><img height="25" src="https://kestra.io/linkedin.svg" alt="linkedin" /></a> &nbsp;
<a href="https://www.youtube.com/@kestra-io"><img height="25" src="https://kestra.io/youtube.svg" alt="youtube" /></a> &nbsp;
</p>

<br />
<p align="center">
<img width="460" src="https://kestra.io/logo.svg" alt="Kestra workflow orchestrator" />
<a href="https://www.youtube.com/watch?v=h-P0eK2xN58&ab_channel=Kestra" target="_blank">
<img src="https://kestra.io/startvideo.png" alt="Get started in 4 minutes with Kestra" width="640px" />
</a>
</p>
<p align="center" style="color:grey;"><i>Get started with Kestra in 4 minutes.</i></p>


> Plugin to interact with OpenAI
# Kestra OpenAI plugin

![Kestra orchestrator](https://kestra.io/ui.gif)
Plugin to leverage [OpenAI](https://openai.com/) in your workflows including chat completion, function calling, as well as generating multimodal outputs.

![Kestra orchestrator](https://kestra.io/video.gif)


## Documentation
* The official Kestra documentation can be found under: [kestra.io](https://kestra.io)
* This plugin documentation can be found [here](https://kestra.io/plugins/plugin-openai/)
* Full documentation can be found under [kestra.io/docs](https://kestra.io/docs)
* Documentation for developing a plugin is included in the [Plugin Developer Guide](https://kestra.io/docs/plugin-developer-guide/).


## License
Apache 2.0 © [Kestra Technologies](https://kestra.io)


## Stay up to date

We release new versions every month. Give the [main repository](https://github.com/kestra-io/kestra) a star to stay up to date with the latest releases and get notified about future updates.

![Star the repo](https://kestra.io/star.gif)
17 changes: 10 additions & 7 deletions src/main/java/io/kestra/plugin/openai/ChatCompletion.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,17 +72,16 @@
" - id: prioritize_response",
" type: io.kestra.plugin.openai.ChatCompletion",
" apiKey: \"yourOpenAIapiKey\"",
" model: gpt-3.5-turbo",
" model: gpt-4",
" messages:",
" - role: user",
" content: \"{{inputs.prompt}}\"",
" functions:",
" - name: respond_to_review",
" type: string",
" description: Given the customer product review provided as input, determines how urgently a ",
" reply is required and then provides suggested response text.",
" description: Given the customer product review provided as input, determines how urgently a reply is required and then provides suggested response text.",
" parameters:",
" - name: response_urgency",
" type: string",
" description: How urgently this customer review needs a reply. Bad reviews ",
" must be addressed immediately before anyone sees them. Good reviews can ",
" wait until later.",
Expand All @@ -91,13 +90,17 @@
" - reply_immediately",
" - reply_later",
" - name: response_text",
" description: The text to post online in response to this review.",
" type: string",
" description: The text to post online in response to this review.",
" required: true",
"",
" - id: response",
" - id: response_urgency",
" type: io.kestra.core.tasks.debugs.Return",
" format: \"{{outputs.prioritize_response.choices[0].message.function_call.arguments.response_urgency}}\"",
"",
" - id: response_text",
" type: io.kestra.core.tasks.debugs.Return",
" format: \"{{outputs.completion.choices[0].message.function_call}}\""
" format: \"{{outputs.prioritize_response.choices[0].message.function_call.arguments.response_text}}\""
}
)
}
Expand Down

0 comments on commit 1a9fbd1

Please sign in to comment.