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

Include stats in readProject #408

Merged
merged 7 commits into from
Feb 7, 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
2 changes: 1 addition & 1 deletion .github/actions/python-integration-tests/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ runs:
LANGCHAIN_TRACING_V2: "true"
LANGCHAIN_API_KEY: ${{ inputs.langchain-api-key }}
OPENAI_API_KEY: ${{ inputs.openai-api-key }}
run: make integration_tests
run: make integration_tests_fast
shell: bash
working-directory: python
4 changes: 2 additions & 2 deletions python/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ tests_watch:
poetry run ptw --now . -- -vv -x tests/unit_tests

integration_tests:
poetry run pytest tests/integration_tests
poetry run pytest -v --durations=10 --cov=langsmith --cov-report=term-missing --cov-report=html --cov-config=.coveragerc tests/integration_tests

integration_tests_fast:
poetry run pytest -n auto tests/integration_tests
poetry run pytest -n auto --durations=10 -v --cov=langsmith --cov-report=term-missing --cov-report=html --cov-config=.coveragerc tests/integration_tests

lint:
poetry run ruff .
Expand Down
23 changes: 23 additions & 0 deletions python/langsmith/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1655,6 +1655,29 @@ def read_project(
**response.json(), _host_url=self._host_url
)

def has_project(
self, project_name: str, *, project_id: Optional[str] = None
) -> bool:
"""Check if a project exists.

Parameters
----------
project_name : str
The name of the project to check for.
project_id : str or None, default=None
The ID of the project to check for.

Returns
-------
bool
Whether the project exists.
"""
try:
self.read_project(project_name=project_name)
except ls_utils.LangSmithNotFoundError:
return False
return True

def get_test_results(
self,
*,
Expand Down
101 changes: 87 additions & 14 deletions python/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ freezegun = "^1.2.2"
pytest-subtests = "^0.11.0"
pytest-watcher = "^0.3.4"
pytest-xdist = "^3.5.0"
pytest-cov = "^4.1.0"

[tool.poetry.group.lint.dependencies]
openai = "^1.10"
Expand Down
Loading
Loading