Skip to content

Commit

Permalink
Multitenancy v2 changes for prompt studio apps - Prompt studio core, …
Browse files Browse the repository at this point in the history
…Registry (#720)

* Multitenancy v2 changes for prompt studio apps

* resolved import issues

---------

Co-authored-by: ali-zipstack <[email protected]>
  • Loading branch information
harini-venkataraman and muhammad-ali-e authored Sep 25, 2024
1 parent 275ade1 commit 88659df
Show file tree
Hide file tree
Showing 15 changed files with 283 additions and 103 deletions.
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

0 comments on commit 88659df

Please sign in to comment.