-
Notifications
You must be signed in to change notification settings - Fork 632
Prompt Studio - Summarize, Output Analyzer and other UI Improvements #9
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
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
4872fd4
Added /extract and /summarize path
tahierhussain fe3b205
Handled the logic to toggle between extract and summarize
tahierhussain 498b42a
Persist the evaluation data inside the output manager
tahierhussain f71c791
Handled summarize view, raw view, persistence of eval data, and outpu…
tahierhussain ec5c932
Merge remote-tracking branch 'origin/main' into feature/prompt-studio…
Deepak-Kesavan 0f01042
UI improvements and bug fixes
tahierhussain f26639c
Handled the state updation for the form values in SelectLlmProfileModal
tahierhussain b76c75f
Merge branch 'feature/prompt-studio-summarize' of github.com:Zipstack…
Deepak-Kesavan d60d5cf
Fixed the popup issue to display the error message
tahierhussain c7c07ed
Merge branch 'feature/prompt-studio-summarize' of github.com:Zipstack…
Deepak-Kesavan ddfce88
Added migration files for summarize and eval
Deepak-Kesavan daef5ce
Added support for processor plugins
Deepak-Kesavan a48175f
Fixed scroll issue in the output analyzer
tahierhussain a1ef571
Merge branch 'main' into feature/prompt-studio-summarize
Deepak-Kesavan a41f5f8
Updated sdk version and resolved review comments
Deepak-Kesavan 5c1e02d
Updated migrations
Deepak-Kesavan 6744598
Added processor directory
Deepak-Kesavan 9309da5
Updated sdk version to 0.12.1
Deepak-Kesavan 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
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
27 changes: 27 additions & 0 deletions
27
backend/adapter_processor/migrations/0005_alter_adapterinstance_adapter_type.py
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,27 @@ | ||
| # Generated by Django 4.2.1 on 2024-02-28 09:03 | ||
|
|
||
| from django.db import migrations, models | ||
|
|
||
|
|
||
| class Migration(migrations.Migration): | ||
| dependencies = [ | ||
| ("adapter_processor", "0004_alter_adapterinstance_adapter_type"), | ||
| ] | ||
|
|
||
| operations = [ | ||
| migrations.AlterField( | ||
| model_name="adapterinstance", | ||
| name="adapter_type", | ||
| field=models.CharField( | ||
| choices=[ | ||
| ("UNKNOWN", "UNKNOWN"), | ||
| ("LLM", "LLM"), | ||
| ("EMBEDDING", "EMBEDDING"), | ||
| ("VECTOR_DB", "VECTOR_DB"), | ||
| ("OCR", "OCR"), | ||
| ("X2TEXT", "X2TEXT"), | ||
| ], | ||
| db_comment="Type of adapter LLM/EMBEDDING/VECTOR_DB", | ||
| ), | ||
| ), | ||
| ] |
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Empty file.
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,76 @@ | ||
| import logging | ||
| import os | ||
| from importlib import import_module | ||
| from typing import Any | ||
|
|
||
| from django.apps import apps | ||
|
|
||
| logger = logging.getLogger(__name__) | ||
|
|
||
|
|
||
| class ProcessorConfig: | ||
| """Loader config for processor plugins.""" | ||
|
|
||
| PLUGINS_APP = "plugins" | ||
| PLUGIN_DIR = "processor" | ||
| MODULE = "module" | ||
| METADATA = "metadata" | ||
| METADATA_NAME = "name" | ||
| METADATA_SERVICE_CLASS = "service_class" | ||
| METADATA_IS_ACTIVE = "is_active" | ||
|
|
||
|
|
||
| def load_plugins() -> list[Any]: | ||
| """Iterate through the processor plugins and register them.""" | ||
| plugins_app = apps.get_app_config(ProcessorConfig.PLUGINS_APP) | ||
| package_path = plugins_app.module.__package__ | ||
| processor_dir = os.path.join(plugins_app.path, ProcessorConfig.PLUGIN_DIR) | ||
| processor_package_path = f"{package_path}.{ProcessorConfig.PLUGIN_DIR}" | ||
| processor_plugins: list[Any] = [] | ||
|
|
||
| for item in os.listdir(processor_dir): | ||
| # Loads a plugin if it is in a directory. | ||
| if os.path.isdir(os.path.join(processor_dir, item)): | ||
| processor_module_name = item | ||
| # Loads a plugin if it is a shared library. | ||
| # Module name is extracted from shared library name. | ||
| # `processor.platform_architecture.so` will be file name and | ||
| # `processor` will be the module name. | ||
| elif item.endswith(".so"): | ||
| processor_module_name = item.split(".")[0] | ||
| else: | ||
| continue | ||
| try: | ||
| full_module_path = ( | ||
| f"{processor_package_path}.{processor_module_name}" | ||
| ) | ||
| module = import_module(full_module_path) | ||
| metadata = getattr(module, ProcessorConfig.METADATA, {}) | ||
|
|
||
| if metadata.get(ProcessorConfig.METADATA_IS_ACTIVE, False): | ||
| processor_plugins.append( | ||
| { | ||
| ProcessorConfig.MODULE: module, | ||
| ProcessorConfig.METADATA: module.metadata, | ||
| } | ||
| ) | ||
| logger.info( | ||
| "Loaded processor plugin: %s, is_active: %s", | ||
| module.metadata[ProcessorConfig.METADATA_NAME], | ||
| module.metadata[ProcessorConfig.METADATA_IS_ACTIVE], | ||
| ) | ||
| else: | ||
| logger.info( | ||
| "Processor plugin %s is not active.", | ||
| processor_module_name, | ||
| ) | ||
| except ModuleNotFoundError as exception: | ||
| logger.error( | ||
| "Error while importing processor plugin: %s", | ||
| exception, | ||
| ) | ||
|
|
||
| if len(processor_plugins) == 0: | ||
| logger.info("No processor plugins found.") | ||
|
|
||
| return processor_plugins |
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
42 changes: 42 additions & 0 deletions
42
...ompt_studio/prompt_studio_core/migrations/0004_customtool_summarize_as_source_and_more.py
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,42 @@ | ||
| # Generated by Django 4.2.1 on 2024-02-27 05:43 | ||
|
|
||
| import django.db.models.deletion | ||
| from django.db import migrations, models | ||
|
|
||
|
|
||
| class Migration(migrations.Migration): | ||
| dependencies = [ | ||
| ("prompt_profile_manager", "0006_alter_profilemanager_x2text"), | ||
| ("prompt_studio_core", "0003_merge_20240125_1501"), | ||
| ] | ||
|
|
||
| operations = [ | ||
| migrations.AddField( | ||
| model_name="customtool", | ||
| name="summarize_as_source", | ||
| field=models.BooleanField(default=True), | ||
| ), | ||
| migrations.AddField( | ||
| model_name="customtool", | ||
| name="summarize_context", | ||
| field=models.BooleanField(default=True), | ||
| ), | ||
| migrations.AddField( | ||
| model_name="customtool", | ||
| name="summarize_llm_profile", | ||
| field=models.ForeignKey( | ||
| blank=True, | ||
| null=True, | ||
| on_delete=django.db.models.deletion.SET_NULL, | ||
| related_name="summarize_llm_profile", | ||
| to="prompt_profile_manager.profilemanager", | ||
| ), | ||
| ), | ||
| migrations.AddField( | ||
| model_name="customtool", | ||
| name="summarize_prompt", | ||
| field=models.TextField( | ||
| blank=True, db_comment="Field to store the summarize prompt" | ||
| ), | ||
| ), | ||
| ] |
53 changes: 53 additions & 0 deletions
53
...pt_studio/prompt_studio_core/migrations/0005_alter_customtool_default_profile_and_more.py
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,53 @@ | ||
| # Generated by Django 4.2.1 on 2024-02-28 09:03 | ||
|
|
||
| import django.db.models.deletion | ||
| from django.db import migrations, models | ||
|
|
||
|
|
||
| class Migration(migrations.Migration): | ||
| dependencies = [ | ||
| ("prompt_profile_manager", "0006_alter_profilemanager_x2text"), | ||
| ("prompt_studio_core", "0004_customtool_summarize_as_source_and_more"), | ||
| ] | ||
|
|
||
| operations = [ | ||
| migrations.AlterField( | ||
| model_name="customtool", | ||
| name="default_profile", | ||
| field=models.ForeignKey( | ||
| blank=True, | ||
| db_comment="Default LLM Profile used in prompt", | ||
| null=True, | ||
| on_delete=django.db.models.deletion.SET_NULL, | ||
| related_name="default_profile", | ||
| to="prompt_profile_manager.profilemanager", | ||
| ), | ||
| ), | ||
| migrations.AlterField( | ||
| model_name="customtool", | ||
| name="summarize_as_source", | ||
| field=models.BooleanField( | ||
| db_comment="Flag to use summarized content as source", | ||
| default=True, | ||
| ), | ||
| ), | ||
| migrations.AlterField( | ||
| model_name="customtool", | ||
| name="summarize_context", | ||
| field=models.BooleanField( | ||
| db_comment="Flag to summarize content", default=True | ||
| ), | ||
| ), | ||
| migrations.AlterField( | ||
| model_name="customtool", | ||
| name="summarize_llm_profile", | ||
| field=models.ForeignKey( | ||
| blank=True, | ||
| db_comment="LLM Profile used for summarize", | ||
| null=True, | ||
| on_delete=django.db.models.deletion.SET_NULL, | ||
| related_name="summarize_llm_profile", | ||
| to="prompt_profile_manager.profilemanager", | ||
| ), | ||
| ), | ||
| ] |
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
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.