Skip to content

Commit

Permalink
rm python changes
Browse files Browse the repository at this point in the history
  • Loading branch information
madams0013 committed Jul 23, 2024
1 parent f96aa6d commit 81e6b4c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 31 deletions.
43 changes: 13 additions & 30 deletions python/langsmith/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -4920,22 +4920,13 @@ def _get_prompt_url(self, prompt_identifier: str) -> str:
)

if not self._current_tenant_is_owner(owner):
if commit_hash is not 'latest':
return f"{self._host_url}/hub/{owner}/{prompt_name}:{commit_hash[:8]}"
else:
return f"{self._host_url}/hub/{owner}/{prompt_name}"
return f"{self._host_url}/hub/{owner}/{prompt_name}:{commit_hash[:8]}"

settings = self._get_settings()
if commit_hash is not 'latest':
return (
f"{self._host_url}/prompts/{prompt_name}/{commit_hash[:8]}"
f"?organizationId={settings.id}"
)
else:
return (
f"{self._host_url}/prompts/{prompt_name}"
f"?organizationId={settings.id}"
)
return (
f"{self._host_url}/prompts/{prompt_name}/{commit_hash[:8]}"
f"?organizationId={settings.id}"
)

def _prompt_exists(self, prompt_identifier: str) -> bool:
"""Check if a prompt exists.
Expand Down Expand Up @@ -4973,16 +4964,6 @@ def unlike_prompt(self, prompt_identifier: str) -> Dict[str, int]:
"""
return self._like_or_unlike_prompt(prompt_identifier, like=False)

def list_commits(
prompt_owner_and_name: str,
limit: Optional[int] = 1,
offset: Optional[int] = 0,
) -> Sequence[ls_schemas.PromptCommit]:
"""List commits for a prompt.
"""

return ''

def list_prompts(
self,
*,
Expand Down Expand Up @@ -5129,7 +5110,6 @@ def create_commit(

try:
from langchain_core.load.dump import dumps
from langchain_core.load.load import loads
except ImportError:
raise ImportError(
"The client.create_commit function requires the langchain_core"
Expand Down Expand Up @@ -5183,11 +5163,14 @@ def update_prompt(
ValueError: If the prompt_identifier is empty.
HTTPError: If the server request fails.
"""
if not self.prompt_exists(prompt_identifier):
raise ls_utils.LangSmithNotFoundError("Prompt does not exist, you must create it first.")

if not self._current_tenant_is_owner(owner):
raise self._owner_conflict_error("update a prompt", owner)
settings = self._get_settings()
if is_public and not settings.tenant_handle:
raise ValueError(
"Cannot create a public prompt without first\n"
"creating a LangChain Hub handle. "
"You can add a handle by creating a public prompt at:\n"
"https://smith.langchain.com/prompts"
)

json: Dict[str, Union[str, bool, Sequence[str]]] = {}

Expand Down
1 change: 0 additions & 1 deletion python/tests/integration_tests/test_prompts.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,6 @@ def test_list_prompts(langsmith_client: Client):
response = langsmith_client.list_prompts(limit=10, offset=0)
assert isinstance(response, ls_schemas.ListPromptsResponse)
assert len(response.repos) <= 10
assert response.total >= len(response.repos)


def test_get_prompt(langsmith_client: Client, prompt_template_1: ChatPromptTemplate):
Expand Down

0 comments on commit 81e6b4c

Please sign in to comment.