-
Notifications
You must be signed in to change notification settings - Fork 5
fix: use graph_config as source of truth in marketplace #185
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -73,8 +73,34 @@ def merge_prompt_configs(base: PromptConfig, override: PromptConfig) -> PromptCo | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return PromptConfig.model_validate(base_dict) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| def get_display_prompt_from_config(config: dict[str, Any]) -> str | None: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| """ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Extract display prompt from snapshot configuration for UI purposes. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Priority: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1. graph_config.prompt_config.custom_instructions | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2. Legacy prompt field | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Args: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| config: The snapshot configuration dict | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Returns: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| The display prompt string or None if not found | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| """ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Priority 1: Check graph_config.prompt_config.custom_instructions | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| graph_config = config.get("graph_config") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if graph_config: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| prompt_config = graph_config.get("prompt_config", {}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if custom_instructions := prompt_config.get("custom_instructions"): | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return custom_instructions | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Priority 2: Legacy prompt field | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return config.get("prompt") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| __all__ = [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "DEFAULT_PROMPT_CONFIG", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "get_prompt_config_from_graph_config", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "merge_prompt_configs", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "get_display_prompt_from_config", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+76
to
+105
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| def get_display_prompt_from_config(config: dict[str, Any]) -> str | None: | |
| """ | |
| Extract display prompt from snapshot configuration for UI purposes. | |
| Priority: | |
| 1. graph_config.prompt_config.custom_instructions | |
| 2. Legacy prompt field | |
| Args: | |
| config: The snapshot configuration dict | |
| Returns: | |
| The display prompt string or None if not found | |
| """ | |
| # Priority 1: Check graph_config.prompt_config.custom_instructions | |
| graph_config = config.get("graph_config") | |
| if graph_config: | |
| prompt_config = graph_config.get("prompt_config", {}) | |
| if custom_instructions := prompt_config.get("custom_instructions"): | |
| return custom_instructions | |
| # Priority 2: Legacy prompt field | |
| return config.get("prompt") | |
| __all__ = [ | |
| "DEFAULT_PROMPT_CONFIG", | |
| "get_prompt_config_from_graph_config", | |
| "merge_prompt_configs", | |
| "get_display_prompt_from_config", | |
| __all__ = [ | |
| "DEFAULT_PROMPT_CONFIG", | |
| "get_prompt_config_from_graph_config", | |
| "merge_prompt_configs", |
Uh oh!
There was an error while loading. Please reload this page.