Skip to content
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
4 changes: 4 additions & 0 deletions .github/workflows/langchain_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ jobs:
uses: ./.github/workflows/test.yml
with:
folder_path: "."
secrets:
UIPATH_URL: ${{ secrets.UIPATH_URL }}
UIPATH_CLIENT_ID: ${{ secrets.UIPATH_CLIENT_ID }}
UIPATH_CLIENT_SECRET: ${{ secrets.UIPATH_CLIENT_SECRET }}

build:
needs: [lint, test]
Expand Down
10 changes: 7 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,14 @@ name: Reusable Test Workflow

on:
workflow_call:
secrets:
UIPATH_URL:
required: true
UIPATH_CLIENT_ID:
required: true
UIPATH_CLIENT_SECRET:
required: true
inputs:

folder_path:
description: 'The folder path to run actions in'
required: true
Expand Down Expand Up @@ -44,6 +50,4 @@ jobs:
UIPATH_URL: ${{ secrets.UIPATH_URL }}
UIPATH_CLIENT_ID: ${{ secrets.UIPATH_CLIENT_ID }}
UIPATH_CLIENT_SECRET: ${{ secrets.UIPATH_CLIENT_SECRET }}
UIPATH_ORGANIZATION_ID: ${{ vars.UIPATH_ORGANIZATION_ID }}
UIPATH_TENANT_ID: ${{ vars.UIPATH_TENANT_ID }}

2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"titleBar.inactiveBackground": "#0099cc"
},
"python.testing.pytestArgs": [
"sdk"
"tests"
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true
Expand Down

This file was deleted.

This file was deleted.

3 changes: 0 additions & 3 deletions src/uipath_langchain/_utils/tests/tests_uipath_cache.db

This file was deleted.

This file was deleted.

This file was deleted.

3 changes: 0 additions & 3 deletions src/uipath_langchain/utils/tests/tests_uipath_cache.db

This file was deleted.

27 changes: 23 additions & 4 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,30 @@
from langchain_community.cache import SQLiteCache

from uipath_langchain.embeddings import UiPathOpenAIEmbeddings
from uipath_langchain.utils._settings import uipath_cached_paths_settings
from uipath_langchain.utils._settings import UiPathCachedPathsSettings

test_cache_settings = UiPathCachedPathsSettings(
CACHED_COMPLETION_DB="tests/llm_cache/tests_uipath_cache.sqlite",
CACHED_EMBEDDINGS_DIR="tests/llm_cache/cached_embeddings",
)


def get_from_uipath_url():
try:
url = os.getenv("UIPATH_URL")
if url:
return "/".join(url.split("/", 3)[:3])
except Exception:
return None
return None


def get_token():
url_get_token = f"{env.get('UIPATH_URL', '').rstrip('/')}/identity_/connect/token"
url_get_token = f"{get_from_uipath_url().rstrip('/')}/identity_/connect/token"

os.environ["UIPATH_REQUESTING_PRODUCT"] = "uipath-python-sdk"
os.environ["UIPATH_REQUESTING_FEATURE"] = "langgraph-agent"
os.environ["UIPATH_TESTS_CACHE_LLMGW"] = "true"

token_credentials = {
"client_id": env.get("UIPATH_CLIENT_ID"),
Expand Down Expand Up @@ -49,7 +68,7 @@ def cached_llmgw_calls() -> Generator[Optional[SQLiteCache], None, None]:
yield None
else:
logging.info("Setting up LLMGW cache")
db_path = uipath_cached_paths_settings.cached_completion_db
db_path = test_cache_settings.cached_completion_db
os.makedirs(os.path.dirname(db_path), exist_ok=True)
cache = SQLiteCache(database_path=db_path)
set_llm_cache(cache)
Expand All @@ -68,7 +87,7 @@ def cached_embedder() -> Generator[Optional[CacheBackedEmbeddings], None, None]:
embedder = CacheBackedEmbeddings.from_bytes_store(
underlying_embeddings=UiPathOpenAIEmbeddings(model=model),
document_embedding_cache=LocalFileStore(
uipath_cached_paths_settings.cached_embeddings_dir
test_cache_settings.cached_embeddings_dir
),
namespace=model,
)
Expand Down
Loading