Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: ai-prompt-template plugin #11517

Merged
merged 16 commits into from
Aug 29, 2024

Conversation

shreemaan-abhishek
Copy link
Contributor

@shreemaan-abhishek shreemaan-abhishek commented Aug 21, 2024

Description

Implement ai-prompt-template plugin.

Checklist

  • I have explained the need for this PR and the problem it solves
  • I have explained the changes or the new features added to this PR
  • I have added tests corresponding to this change
  • I have updated the documentation to reflect this change
  • I have verified that this change is backward compatible (If not, please discuss on the APISIX mailing list first)

@shreemaan-abhishek shreemaan-abhishek marked this pull request as ready for review August 21, 2024 09:30
@dosubot dosubot bot added size:XL This PR changes 500-999 lines, ignoring generated files. doc Documentation things enhancement New feature or request plugin labels Aug 21, 2024
@bzp2010 bzp2010 self-requested a review August 23, 2024 05:43
Copy link
Contributor

@bzp2010 bzp2010 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

apisix/plugins/ai-prompt-template.lua Show resolved Hide resolved
apisix/plugins/ai-prompt-template.lua Outdated Show resolved Hide resolved
@bzp2010 bzp2010 self-requested a review August 28, 2024 03:15
bzp2010
bzp2010 previously approved these changes Aug 28, 2024
Copy link
Contributor

@bzp2010 bzp2010 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code LGTM

@bzp2010 bzp2010 requested a review from kayx23 August 28, 2024 03:44

## Description

The `ai-prompt-template` plugin simplifies access to AI providers and models by predefining the request format
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The `ai-prompt-template` plugin simplifies access to AI providers and models by predefining the request format
The `ai-prompt-template` plugin simplifies access to LLM providers, such as OpenAI and Anthropic, and their models by predefining the request format

## Description

The `ai-prompt-template` plugin simplifies access to AI providers and models by predefining the request format
using a template and allowing users to pass only the values for template variables.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
using a template and allowing users to pass only the values for template variables.
using a template, which only allows users to pass customized values into template variables.

| ------------------------------------- | -------- | --------------------------------------------------- | ------------ |
| `templates` | Array | An array of template objects | Yes |
| `templates.name` | String | Name of the template. | Yes |
| `templates.template.model` | String | Model of the AI Model. Example: gpt-4, gpt-3.5 | Yes |
Copy link
Member

@kayx23 kayx23 Aug 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| `templates.template.model` | String | Model of the AI Model. Example: gpt-4, gpt-3.5 | Yes |
| `templates.template.model` | String | Model of the AI Model, for example `gpt-4` or `gpt-3.5`. See your LLM provider API documentation for more available models. | Yes |

docs/en/latest/plugins/ai-prompt-template.md Show resolved Hide resolved
docs/en/latest/plugins/ai-prompt-template.md Outdated Show resolved Hide resolved
moonming
moonming previously approved these changes Aug 28, 2024
shreemaan-abhishek and others added 3 commits August 28, 2024 22:53
Co-authored-by: Traky Deng <trakydeng@gmail.com>
Copy link
Member

@kayx23 kayx23 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doc LGTM

@shreemaan-abhishek shreemaan-abhishek merged commit e775640 into apache:master Aug 29, 2024
34 checks passed
@shreemaan-abhishek shreemaan-abhishek deleted the prompt-template branch August 29, 2024 07:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc Documentation things enhancement New feature or request plugin size:XL This PR changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants