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

Multitenancy v2 changes for prompt studio apps - Prompt studio core, Registry #720

Merged
merged 4 commits into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion backend/prompt_studio/prompt_studio_core_v2/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ class ToolStudioPromptKeys:
WORD = "word"
SYNONYMS = "synonyms"
OUTPUTS = "outputs"
ASSERT_PROMPT = "assert_prompt"
SECTION = "section"
DEFAULT = "default"
REINDEX = "reindex"
Expand All @@ -89,6 +88,12 @@ class ToolStudioPromptKeys:
CONTEXT = "context"
METADATA = "metadata"
INCLUDE_METADATA = "include_metadata"
TXT_EXTENTION = ".txt"
TABLE = "table"
EXTRACT = "extract"
PLATFORM_POSTAMBLE = "platform_postamble"
SUMMARIZE_AS_SOURCE = "summarize_as_source"
VARIABLE_MAP = "variable_map"


class FileViewTypes:
Expand Down
9 changes: 9 additions & 0 deletions backend/prompt_studio/prompt_studio_core_v2/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from typing import Optional

from prompt_studio.prompt_profile_manager_v2.constants import ProfileManagerKeys
from prompt_studio.prompt_studio_core_v2.constants import ToolStudioErrors
from rest_framework.exceptions import APIException
Expand Down Expand Up @@ -86,3 +88,10 @@ class PromptNotRun(APIException):
"it can be used as a variable in another prompt. "
"Please execute the prompt first and try again."
)

def __init__(self, detail: Optional[str] = None, code: Optional[int] = None):
if detail is not None:
self.detail = detail
if code is not None:
self.code = code
super().__init__(detail, code)
4 changes: 4 additions & 0 deletions backend/prompt_studio/prompt_studio_core_v2/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ class CustomTool(DefaultOrganizationMixin, BaseModel):
db_comment="Flag to enable or disable document highlighting", default=False
)

enable_highlight = models.BooleanField(
db_comment="Flag to enable or disable document highlighting", default=False
)

# Introduced field to establish M2M relation between users and custom_tool.
# This will introduce intermediary table which relates both the models.
shared_users = models.ManyToManyField(User, related_name="shared_custom_tools")
Expand Down
Loading