mirror of
https://github.com/googleapis/genai-toolbox.git
synced 2026-01-09 07:28:05 -05:00
chore: embed Config into resource for prompts (#1951)
To keep a persistent backend storage for configuration, we will have to keep a single source of truth. This involves supporting bi-directional conversion for Prompt and Promptsets. This PR make the following changes: * Separate Prompt from PromptConfig * Embed Config in Resources (for both prompt and promptset) * Add `ToConfig()` to extract Config from Resources (for both prompt and promptset)
This commit is contained in:
@@ -35,8 +35,8 @@ import (
|
||||
const fakeVersionString = "0.0.0"
|
||||
|
||||
var (
|
||||
_ tools.Tool = &MockTool{}
|
||||
_ prompts.Prompt = &MockPrompt{}
|
||||
_ tools.Tool = MockTool{}
|
||||
_ prompts.Prompt = MockPrompt{}
|
||||
)
|
||||
|
||||
// MockTool is used to mock tools in tests
|
||||
@@ -157,6 +157,10 @@ func (p MockPrompt) McpManifest() prompts.McpManifest {
|
||||
return prompts.GetMcpManifest(p.Name, p.Description, p.Args)
|
||||
}
|
||||
|
||||
func (p MockPrompt) ToConfig() prompts.PromptConfig {
|
||||
return nil
|
||||
}
|
||||
|
||||
var tool1 = MockTool{
|
||||
Name: "no_params",
|
||||
Params: []parameters.Parameter{},
|
||||
|
||||
@@ -156,7 +156,10 @@ func TestUpdateServer(t *testing.T) {
|
||||
newPrompts := map[string]prompts.Prompt{"example-prompt": nil}
|
||||
newPromptsets := map[string]prompts.Promptset{
|
||||
"example-promptset": {
|
||||
Name: "example-promptset", Prompts: []*prompts.Prompt{},
|
||||
PromptsetConfig: prompts.PromptsetConfig{
|
||||
Name: "example-promptset",
|
||||
},
|
||||
Prompts: []*prompts.Prompt{},
|
||||
},
|
||||
}
|
||||
s.ResourceMgr.SetResources(newSources, newAuth, newTools, newToolsets, newPrompts, newPromptsets)
|
||||
|
||||
Reference in New Issue
Block a user