mirror of
https://github.com/langchain-ai/langsmith-migrations.git
synced 2026-07-01 20:03:59 -04:00
Merge pull request #4 from langchain-ai/rahul/update-langfuse
Update LangFuse functionality
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
from utils.langsmith import ls_get_or_create_workspace
|
||||
from config import LS_WORKSPACE_ID
|
||||
|
||||
from providers.langfuse.data.prompts import migrate_prompts
|
||||
from providers.langfuse.data.datasets import migrate_datasets
|
||||
@@ -12,9 +13,13 @@ def migrate_langfuse(projects: list[dict]):
|
||||
pid = proj.get("id") or proj.get("project_id") or proj.get("uuid") or ""
|
||||
print(f"\n- Project: {pname}")
|
||||
|
||||
ws = ls_get_or_create_workspace(pname)
|
||||
ws_id = ws["id"]
|
||||
print(f" + workspace id: {ws_id}")
|
||||
if LS_WORKSPACE_ID:
|
||||
ws_id = LS_WORKSPACE_ID
|
||||
print(f" + using workspace: {ws_id}")
|
||||
else:
|
||||
ws = ls_get_or_create_workspace(pname)
|
||||
ws_id = ws["id"]
|
||||
print(f" + workspace id: {ws_id}")
|
||||
|
||||
migrate_prompts(ws_id, pid)
|
||||
migrate_datasets(ws_id, pid)
|
||||
|
||||
+2
-2
@@ -55,7 +55,7 @@ def ls_push_prompt(
|
||||
pat = pat or LS_API_KEY
|
||||
session = requests.Session()
|
||||
session.headers.update({"X-Tenant-Id": workspace_id})
|
||||
client = Client(api_key=pat, api_url=LS_BASE, session=session)
|
||||
client = Client(api_key=pat, api_url=f"{LS_BASE}/api/v1", session=session)
|
||||
|
||||
url = client.push_prompt(
|
||||
name,
|
||||
@@ -80,7 +80,7 @@ def ls_replay_runs_sdk(workspace_id: str, runs: list[dict], project_name: str =
|
||||
"""
|
||||
session = requests.Session()
|
||||
session.headers.update({"X-Tenant-Id": workspace_id})
|
||||
client = Client(api_key=LS_API_KEY, api_url=LS_BASE, session=session)
|
||||
client = Client(api_key=LS_API_KEY, api_url=f"{LS_BASE}/api/v1", session=session)
|
||||
|
||||
def _parse_dt(val):
|
||||
if not val:
|
||||
|
||||
Reference in New Issue
Block a user