-
Notifications
You must be signed in to change notification settings - Fork 61
feat: implement AI plugin calling interface with dedicated endpoints #826
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
Merged
LinuxSuRen
merged 7 commits into
LinuxSuRen:master
from
KariHall619:ai-plugin-call-logic
Sep 15, 2025
Merged
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
0cb08b0
feat: implement AI plugin calling interface with dedicated endpoints
KariHall619 bbc9ee2
Update copyright year in ai_interface.go
KariHall619 e5a05fd
rollback: use protoc-gen-go v1.28.1 for compatibility
KariHall619 f75b0a8
rollback: use protoc v4.22.2 for full compatibility
KariHall619 657ea79
resolve: merge conflicts in AI plugin interface
KariHall619 52c5d7d
rollback: protoc-gen-go-grpc v1.2.0 for compatibility
KariHall619 905f753
refactor: simplify AI plugin config parameter handling
KariHall619 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,100 @@ | ||
| /* | ||
| Copyright 2024 API Testing Authors. | ||
| Licensed under the Apache License, Version 2.0 (the "License"); | ||
| you may not use this file except in compliance with the License. | ||
| You may obtain a copy of the License at | ||
| http://www.apache.org/licenses/LICENSE-2.0 | ||
| Unless required by applicable law or agreed to in writing, software | ||
| distributed under the License is distributed on an "AS IS" BASIS, | ||
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| See the License for the specific language governing permissions and | ||
| limitations under the License. | ||
| */ | ||
|
|
||
| package server | ||
|
|
||
| // AI Plugin Communication Interface Standards | ||
| // AI plugins use the existing testing.Loader.Query(map[string]string) interface | ||
|
|
||
| // Standard AI plugin communication methods | ||
| const ( | ||
| AIMethodGenerate = "ai.generate" // Generate content from prompt | ||
| AIMethodCapabilities = "ai.capabilities" // Get plugin capabilities | ||
| ) | ||
|
|
||
| // AI Plugin Query Parameter Standards | ||
| // AI plugins are called using loader.Query(query map[string]string) with these parameters: | ||
|
|
||
| // For ai.generate: | ||
| // - "method": "ai.generate" | ||
| // - "model": model identifier (e.g., "gpt-4", "claude") | ||
| // - "prompt": the prompt or instruction | ||
| // - "config": optional JSON configuration string (e.g., `{"temperature": 0.7, "max_tokens": 1000}`) | ||
|
|
||
| // For ai.capabilities: | ||
| // - "method": "ai.capabilities" | ||
|
|
||
| // AI Plugin Response Standards | ||
| // AI plugins return response through testing.DataResult.Pairs with these keys: | ||
|
|
||
| // For successful ai.generate: | ||
| // - "content": the generated content | ||
| // - "meta": optional JSON metadata string (model info, timing, etc.) | ||
| // - "success": "true" | ||
|
|
||
| // For successful ai.capabilities: | ||
| // - "capabilities": JSON string containing plugin capabilities | ||
| // - "models": JSON array of supported models (fallback if capabilities not available) | ||
| // - "features": JSON array of supported features (fallback) | ||
| // - "description": plugin description (fallback) | ||
| // - "version": plugin version (fallback) | ||
| // - "success": "true" | ||
|
|
||
| // For errors: | ||
| // - "error": error message | ||
| // - "success": "false" | ||
|
|
||
| // Plugin Discovery | ||
| // AI plugins are identified by having "ai" in their categories field: | ||
| // categories: ["ai"] | ||
|
|
||
| // Usage Examples: | ||
| // | ||
| // Get AI plugins: | ||
| // stores, err := server.GetStores(ctx, &SimpleQuery{Kind: "ai"}) | ||
| // | ||
| // Call AI plugin: | ||
| // loader, err := server.getLoaderByStoreName("my-ai-plugin") | ||
| // result, err := loader.Query(map[string]string{ | ||
| // "method": "ai.generate", | ||
| // "model": "gpt-4", | ||
| // "prompt": "Hello world", | ||
| // "config": `{"temperature": 0.7}`, | ||
| // }) | ||
| // content := result.Pairs["content"] | ||
|
|
||
| // Documentation structures (for reference only, actual types are generated from proto) | ||
| // See server.proto for the actual message definitions: | ||
| // | ||
| // AIRequest fields: | ||
| // - plugin_name: AI plugin name | ||
| // - model: Model identifier (e.g., "gpt-4", "claude") | ||
| // - prompt: The prompt or instruction | ||
| // - config: JSON configuration string (optional) | ||
| // | ||
| // AIResponse fields: | ||
| // - content: Generated content | ||
| // - meta: JSON metadata string (optional) | ||
| // - success: Whether the call succeeded | ||
| // - error: Error message if failed | ||
| // | ||
| // AICapabilitiesResponse fields: | ||
| // - models: Supported models | ||
| // - features: Supported features | ||
| // - description: Plugin description | ||
| // - version: Plugin version | ||
| // - success: Whether the call succeeded | ||
| // - error: Error message if failed | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.