@langwatch/server 3.1.0-beta.21 → 3.1.0-beta.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/langevals/evaluators/topic_clustering/langevals_topic_clustering/__init__.py +36 -0
- package/langevals/evaluators/topic_clustering/langevals_topic_clustering/_logger.py +165 -0
- package/langevals/evaluators/topic_clustering/langevals_topic_clustering/batch_clustering.py +153 -0
- package/langevals/evaluators/topic_clustering/langevals_topic_clustering/build_response.py +77 -0
- package/langevals/evaluators/topic_clustering/langevals_topic_clustering/constants.py +7 -0
- package/langevals/evaluators/topic_clustering/langevals_topic_clustering/incremental_clustering.py +325 -0
- package/langevals/evaluators/topic_clustering/langevals_topic_clustering/topic_naming.py +432 -0
- package/langevals/evaluators/topic_clustering/langevals_topic_clustering/types.py +42 -0
- package/langevals/evaluators/topic_clustering/langevals_topic_clustering/utils.py +191 -0
- package/langevals/evaluators/topic_clustering/pyproject.toml +52 -0
- package/langevals/evaluators/topic_clustering/tests/test_topic_clustering.py +239 -0
- package/langevals/evaluators/topic_clustering/tests/test_topic_clustering_integration.py +97 -0
- package/langevals/evaluators/topic_clustering/tests/test_topic_naming.py +72 -0
- package/langevals/langevals/pytest_plugins/pass_rate_plugin.py +7 -1
- package/langevals/langevals/server.py +28 -0
- package/langevals/pyproject.toml +3 -0
- package/langevals/uv.lock +119 -20
- package/langwatch/dist/client/assets/{AnnotationsTable-BDAkYaz6.js → AnnotationsTable-uS_9SQ-g.js} +2 -2
- package/langwatch/dist/client/assets/{BatchEvaluationSummary-DMaQM_VB.js → BatchEvaluationSummary-DtFd8yKJ.js} +2 -2
- package/langwatch/dist/client/assets/{BudgetEditDrawer-CHaqmdIl.js → BudgetEditDrawer-CHEPz0hH.js} +2 -2
- package/langwatch/dist/client/assets/{ChartCard-D14PUg_d.js → ChartCard-s5fMPo7b.js} +2 -2
- package/langwatch/dist/client/assets/{ChatWindow-CRDnlP-Q.js → ChatWindow-C0XSteVJ.js} +2 -2
- package/langwatch/dist/client/assets/ChatWindow-DFEmNXQL.js +1 -0
- package/langwatch/dist/client/assets/{ConfirmDialog-CXIhncvW.js → ConfirmDialog-M94yLNvP.js} +2 -2
- package/langwatch/dist/client/assets/{ContactSalesBlock-CijLBwRC.js → ContactSalesBlock-CnnuZ8iI.js} +2 -2
- package/langwatch/dist/client/assets/{DSPyExperiment-B1YOL2m8.js → DSPyExperiment-CMA6lrlx.js} +2 -2
- package/langwatch/dist/client/assets/{FilterDisplay-BB0xWrLn.js → FilterDisplay-0S3NqCkq.js} +2 -2
- package/langwatch/dist/client/assets/{FormatMoney-w9vr_h0X.js → FormatMoney-CCygtAHg.js} +2 -2
- package/langwatch/dist/client/assets/{FoundryDrawer-CdJDXtpz.js → FoundryDrawer-B35xZ26C.js} +2 -2
- package/langwatch/dist/client/assets/{GatewayErrorPanel-DvE9U2dS.js → GatewayErrorPanel-BsaYQEie.js} +2 -2
- package/langwatch/dist/client/assets/{GatewayLayout-lv1p_6B5.js → GatewayLayout-LvwwrwMf.js} +2 -2
- package/langwatch/dist/client/assets/{GraphsLayout-BJ68J9e-.js → GraphsLayout-DJ-HI9N1.js} +2 -2
- package/langwatch/dist/client/assets/{GroupBindingInputRow-DebZBCnD.js → GroupBindingInputRow-CV-fBkX9.js} +2 -2
- package/langwatch/dist/client/assets/{MessagesTable-B6lYde-x.js → MessagesTable-9taaKCOZ.js} +2 -2
- package/langwatch/dist/client/assets/{NavigationFooter-CiOVzDUh.js → NavigationFooter-Dzvauw3l.js} +2 -2
- package/langwatch/dist/client/assets/{NoDataInfoBlock-quSW_MRm.js → NoDataInfoBlock-CLKl_wlX.js} +2 -2
- package/langwatch/dist/client/assets/{OpsPageShell-DJ1WlI6-.js → OpsPageShell-C_mTziRS.js} +2 -2
- package/langwatch/dist/client/assets/{OptimizationStudio-BlozXjcN.js → OptimizationStudio-D2zpsmJj.js} +8 -12
- package/langwatch/dist/client/assets/{PreconditionsField-BOfcWvmZ.js → PreconditionsField-WXB8kcTK.js} +2 -2
- package/langwatch/dist/client/assets/{SettingsLayout-CLCGxMAe.js → SettingsLayout--1gdEuhv.js} +2 -2
- package/langwatch/dist/client/assets/{SubscriptionPage-J8b2Zaj6.js → SubscriptionPage-B0ox_4kM.js} +2 -2
- package/langwatch/dist/client/assets/{VirtualKeySecretReveal-DR1VDLy7.js → VirtualKeySecretReveal-CRbI1dKQ.js} +2 -2
- package/langwatch/dist/client/assets/{WithPermissionGuard-DD8uo3UK.js → WithPermissionGuard-B4Jo8E5-.js} +2 -2
- package/langwatch/dist/client/assets/{__...path__-BZVaIayJ.js → __...path__-BF2zkD84.js} +2 -2
- package/langwatch/dist/client/assets/{_experiment_-B1aT-wS3.js → _experiment_-D02aoVQk.js} +2 -2
- package/langwatch/dist/client/assets/{_id_-oI_eq-I_.js → _id_-Ch8YmTiM.js} +2 -2
- package/langwatch/dist/client/assets/{_id_-DAqPuO73.js → _id_-D6ZvwHpH.js} +2 -2
- package/langwatch/dist/client/assets/{_id_-DUngklVb.js → _id_-DOC1ZkBm.js} +2 -2
- package/langwatch/dist/client/assets/{_id_-jFDAfbob.js → _id_-DfWwW6_N.js} +2 -2
- package/langwatch/dist/client/assets/{_id_-BKBrWGG0.js → _id_-DxUo4W7J.js} +2 -2
- package/langwatch/dist/client/assets/_not-found-COI3ShsR.js +1 -0
- package/langwatch/dist/client/assets/{_project_-Bt1tayHB.js → _project_-_UUt5Ar9.js} +2 -2
- package/langwatch/dist/client/assets/{_runId_-CfvnDt5H.js → _runId_-Dimwzp48.js} +2 -2
- package/langwatch/dist/client/assets/_slug_-BMvKBwS_.js +2 -0
- package/langwatch/dist/client/assets/{_slug_-DZAdl0QS.js → _slug_-CE6VoDSC.js} +2 -2
- package/langwatch/dist/client/assets/{_slug_-DmoWXjKT.js → _slug_-OiOLG1Mv.js} +2 -2
- package/langwatch/dist/client/assets/{_team_-DL_wKSWK.js → _team_-DKvmwO_5.js} +2 -2
- package/langwatch/dist/client/assets/{_workflow_-DcMXLPUe.js → _workflow_-FkilKiB-.js} +3 -3
- package/langwatch/dist/client/assets/{_workflow_-NI9bac7d.js → _workflow_-gJZppg3h.js} +2 -2
- package/langwatch/dist/client/assets/{access-audit-CFwNwusI.js → access-audit-xcUVYMMT.js} +2 -2
- package/langwatch/dist/client/assets/{agents-Di4XRwcn.js → agents-D32g91cu.js} +2 -2
- package/langwatch/dist/client/assets/{all-C273mlDB.js → all-vnREzDZj.js} +2 -2
- package/langwatch/dist/client/assets/{analytics-CEAcSf6B.js → analytics-DP6Y4Feh.js} +2 -2
- package/langwatch/dist/client/assets/{annotation-scores-CHfn4LQp.js → annotation-scores-CjD4CEB6.js} +2 -2
- package/langwatch/dist/client/assets/{annotations-CHZQrha6.js → annotations-1rVXiDRQ.js} +2 -2
- package/langwatch/dist/client/assets/{api-keys-BT7HExHM.js → api-keys-BJpKyuaz.js} +2 -2
- package/langwatch/dist/client/assets/{audit-log-BGk-51Dt.js → audit-log-BdUdZjxp.js} +2 -2
- package/langwatch/dist/client/assets/{authentication-DvwXfkp-.js → authentication-8mQB00CC.js} +2 -2
- package/langwatch/dist/client/assets/{authorize-tXpHrWyw.js → authorize-BpUueMNW.js} +2 -2
- package/langwatch/dist/client/assets/{authorize-CRu9xlpU.js → authorize-CbNBtmxW.js} +2 -2
- package/langwatch/dist/client/assets/{automations-CjDvz9Ak.js → automations-34KMkRxd.js} +2 -2
- package/langwatch/dist/client/assets/{billing-plans-FUqEPN62.js → billing-plans-BUQp08MI.js} +2 -2
- package/langwatch/dist/client/assets/{budgets-BV6_RHrs.js → budgets-CdelE8Hv.js} +2 -2
- package/langwatch/dist/client/assets/{cache-rules-CtYA79E_.js → cache-rules-D2m1QlNJ.js} +2 -2
- package/langwatch/dist/client/assets/choose-C0LdeUiH.js +2 -0
- package/langwatch/dist/client/assets/{command-bar-CaJygoez.js → command-bar-DUK45yin.js} +7 -9
- package/langwatch/dist/client/assets/custom-hBq2K4FJ.js +1 -0
- package/langwatch/dist/client/assets/{datasets-vLWpH84_.js → datasets-ErNNhmjg.js} +2 -2
- package/langwatch/dist/client/assets/{dejaview-DwVR3RGg.js → dejaview-BaD4_v90.js} +2 -2
- package/langwatch/dist/client/assets/{dist-SwV3YZv3.js → dist-Cds4Mqhj.js} +4 -6
- package/langwatch/dist/client/assets/{edit-CyxsmQmW.js → edit-DpT8ejBV.js} +2 -2
- package/langwatch/dist/client/assets/{evaluations-BfgeZMph.js → evaluations-BdQ2Dm2r.js} +2 -2
- package/langwatch/dist/client/assets/{evaluations-HSQIMvbX.js → evaluations-C90I4VAr.js} +2 -2
- package/langwatch/dist/client/assets/{evaluators-DLHVvnrh.js → evaluators-ig_ugRLt.js} +2 -2
- package/langwatch/dist/client/assets/{foundry-Ckq0WjPU.js → foundry-B-X_80pD.js} +2 -2
- package/langwatch/dist/client/assets/{gateway-CDSYPZ6w.js → gateway-CS_mtJx-.js} +2 -2
- package/langwatch/dist/client/assets/{groups-CCCRUqPj.js → groups-Bp90ChP3.js} +2 -2
- package/langwatch/dist/client/assets/{index-Bm6z2fM9.js → index-BEjGS0kI.js} +5 -5
- package/langwatch/dist/client/assets/{license-CHOarGWr.js → license-CgnlvyuI.js} +2 -2
- package/langwatch/dist/client/assets/{me-CBya_vXs.js → me-DEqhm_KC.js} +2 -2
- package/langwatch/dist/client/assets/{members-lIFLh-rh.js → members-CUJANDtH.js} +2 -2
- package/langwatch/dist/client/assets/{messages-CG9j8Dz8.js → messages-fQBfCjvp.js} +2 -2
- package/langwatch/dist/client/assets/{metrics-C9pzeaI6.js → metrics-DeIxebpD.js} +2 -2
- package/langwatch/dist/client/assets/{model-costs-Bc5uqjkl.js → model-costs-C1RbgK--.js} +2 -2
- package/langwatch/dist/client/assets/{model-providers-B5UjRgS_.js → model-providers-Pv3ML_-t.js} +2 -2
- package/langwatch/dist/client/assets/{my-queue-BkEfiWyR.js → my-queue-BLre2NMr.js} +2 -2
- package/langwatch/dist/client/assets/{ops-Cc-g-CMn.js → ops-CCw-FJaT.js} +2 -2
- package/langwatch/dist/client/assets/{organization-features-CoIKKHkQ.js → organization-features-rqg-75mI.js} +2 -2
- package/langwatch/dist/client/assets/{organizations-DWcQUTzi.js → organizations-DjCzIHVx.js} +2 -2
- package/langwatch/dist/client/assets/{persistence-CTQ44vGL.js → persistence-BPvHS0F6.js} +2 -2
- package/langwatch/dist/client/assets/{plans-Dq3eFg5K.js → plans-Ch2Ol-Fd.js} +2 -2
- package/langwatch/dist/client/assets/{projections-CTNj1QBM.js → projections-it4FOVjm.js} +2 -2
- package/langwatch/dist/client/assets/{projects-BxM7C87h.js → projects-CjWZFLfn.js} +2 -2
- package/langwatch/dist/client/assets/{prompts-DhXnJT6e.js → prompts-DilmFH_s.js} +2 -2
- package/langwatch/dist/client/assets/{providers-DW7VWdqq.js → providers-tlLT_lTF.js} +2 -2
- package/langwatch/dist/client/assets/{reports-D3QFKhNP.js → reports-vlrcTrLs.js} +2 -2
- package/langwatch/dist/client/assets/{roles-B_0t5DWA.js → roles-DNgi-NQ9.js} +2 -2
- package/langwatch/dist/client/assets/{scenarios-BX3XslU0.js → scenarios-BmG_wDkR.js} +2 -2
- package/langwatch/dist/client/assets/{scim-DDsLO39r.js → scim-BKr1_FHt.js} +2 -2
- package/langwatch/dist/client/assets/{secrets-BvEGwDCy.js → secrets-CU8ocTGv.js} +2 -2
- package/langwatch/dist/client/assets/{settings-9giNiAQQ.js → settings-CDzdoYVK.js} +2 -2
- package/langwatch/dist/client/assets/{setup-HxXKoVKG.js → setup-nEvn2rjN.js} +2 -2
- package/langwatch/dist/client/assets/{subscription-DhyswDze.js → subscription-BPNl_6jF.js} +3 -3
- package/langwatch/dist/client/assets/{subscriptions-Dyyau22a.js → subscriptions-D0G-OE5C.js} +2 -2
- package/langwatch/dist/client/assets/{teams-DRmeAxzf.js → teams-DThgDQvB.js} +2 -2
- package/langwatch/dist/client/assets/{textOverflowHeuristic-JibhpzDV.js → textOverflowHeuristic-DTC8-Ffx.js} +2 -2
- package/langwatch/dist/client/assets/{topic-clustering-Bllfw5rZ.js → topic-clustering-BR2Mbpao.js} +2 -2
- package/langwatch/dist/client/assets/{topics-CpiGYxqb.js → topics-CI8GoNqp.js} +2 -2
- package/langwatch/dist/client/assets/{traceExecutor-CiHXJB0V.js → traceExecutor-CDUGyUaw.js} +2 -2
- package/langwatch/dist/client/assets/{usage-BnsstwBY.js → usage-B4mR7ut_.js} +2 -2
- package/langwatch/dist/client/assets/{usage-CoyGtJoI.js → usage-C8fbffYi.js} +2 -2
- package/langwatch/dist/client/assets/{useAdminResource-SPC5iBHM.js → useAdminResource-SmnnHro6.js} +2 -2
- package/langwatch/dist/client/assets/{useAnnotationQueues-2DKZTC7r.js → useAnnotationQueues-CA6Vk--V.js} +2 -2
- package/langwatch/dist/client/assets/{useAvailableEvaluators-HndTl2LV.js → useAvailableEvaluators-hmbmcRQr.js} +2 -2
- package/langwatch/dist/client/assets/{useDeleteDatasetConfirmation-BgWN6Qqb.js → useDeleteDatasetConfirmation-BCK_zUUe.js} +2 -2
- package/langwatch/dist/client/assets/{useWorkflowStore-e1wFCvo2.js → useWorkflowStore-QUJ3J8X9.js} +2 -2
- package/langwatch/dist/client/assets/{users-C6wjliCC.js → users-CfhanCfR.js} +2 -2
- package/langwatch/dist/client/assets/{users-tF6ZKeV1.js → users-HjuN3o6k.js} +2 -2
- package/langwatch/dist/client/assets/{virtual-keys-BL-65S0B.js → virtual-keys-Bj-MhW66.js} +2 -2
- package/langwatch/dist/client/assets/{wizard-faGkpZDT.js → wizard-dRWCVVx6.js} +2 -2
- package/langwatch/dist/client/assets/{workbench-Oj0s_YR-.js → workbench-CuixH3G1.js} +2 -2
- package/langwatch/dist/client/assets/{workflows-Cu9k-Twu.js → workflows-BT6m4Yu9.js} +2 -2
- package/langwatch/dist/client/index.html +3 -3
- package/langwatch/dist/scenario-child-process.js +20 -10
- package/langwatch/package.json +2 -2
- package/langwatch/pnpm-lock.yaml +329 -328
- package/langwatch/scripts/seed-dogfood-password.ts +163 -0
- package/langwatch/src/app/api/workflows/post_event/__tests__/post-event-evaluator.integration.test.ts +458 -0
- package/langwatch/src/app/api/workflows/post_event/__tests__/post-event-routing.test.ts +188 -0
- package/langwatch/src/app/api/workflows/post_event/__tests__/post-event.integration.test.ts +274 -0
- package/langwatch/src/app/api/workflows/post_event/post-event.ts +29 -1
- package/langwatch/src/components/agents/AgentCodeEditorDrawer.tsx +4 -5
- package/langwatch/src/components/agents/__tests__/AgentCodeEditorDrawer.integration.test.tsx +40 -0
- package/langwatch/src/components/evaluations/wizard/hooks/evaluation-wizard-store/slices/factories/__tests__/code-execution-node.factory.unit.test.ts +47 -0
- package/langwatch/src/components/evaluations/wizard/hooks/evaluation-wizard-store/slices/factories/code-execution-node.factory.ts +2 -4
- package/langwatch/src/components/experiments/BatchEvaluationV2/BatchEvaluationV2EvaluationResults.tsx +6 -1
- package/langwatch/src/hooks/usePostHog.ts +11 -0
- package/langwatch/src/optimization_studio/__tests__/registry.test.ts +29 -1
- package/langwatch/src/optimization_studio/components/Optimize.tsx +17 -3
- package/langwatch/src/optimization_studio/components/properties/AgentPropertiesPanel.tsx +4 -5
- package/langwatch/src/optimization_studio/hooks/workflowStoreCore.ts +17 -6
- package/langwatch/src/optimization_studio/hooks/workflowStoreCore.unit.test.ts +42 -0
- package/langwatch/src/optimization_studio/registry.ts +2 -4
- package/langwatch/src/optimization_studio/server/lambda/index.ts +12 -2
- package/langwatch/src/server/api/routers/workflows.ts +18 -0
- package/langwatch/src/server/evaluations-v3/execution/workflowBuilder.ts +3 -2
- package/langwatch/src/server/evaluations-v3/services/__tests__/experiment-run.service.getRun-null.unit.test.ts +71 -0
- package/langwatch/src/server/evaluations-v3/services/experiment-run.service.ts +18 -9
- package/langwatch/src/server/modelProviders/utils.ts +11 -1
- package/langwatch/src/server/nlpgo/__tests__/nlpgoFetch.integration.test.ts +248 -0
- package/langwatch/src/server/nlpgo/nlpgoFetch.ts +155 -0
- package/langwatch/src/server/routes/__tests__/playground-proxy.integration.test.ts +242 -0
- package/langwatch/src/server/routes/playground.ts +11 -1
- package/langwatch/src/server/routes/workflows.ts +17 -0
- package/langwatch/src/server/topicClustering/topicClustering.ts +33 -8
- package/langwatch/src/server/workflows/runWorkflow.ts +10 -13
- package/langwatch_nlp/langwatch_nlp/studio/execute/execute_component.py +25 -1
- package/langwatch_nlp/langwatch_nlp/studio/parser.py +121 -16
- package/langwatch_nlp/langwatch_nlp/topic_clustering/topic_naming.py +39 -32
- package/langwatch_nlp/scripts/entrypoint.sh +67 -0
- package/langwatch_nlp/tests/studio/test_parse.py +198 -0
- package/mcp-server/pnpm-lock.yaml +15 -21
- package/package.json +1 -1
- package/packages/server/dist/cli.cjs +78 -94
- package/langwatch/dist/client/assets/ChatWindow-DzB-tNlQ.js +0 -1
- package/langwatch/dist/client/assets/_not-found-PEUaWdF3.js +0 -1
- package/langwatch/dist/client/assets/_slug_-C-8AjsjC.js +0 -2
- package/langwatch/dist/client/assets/choose--PBky27o.js +0 -2
- package/langwatch/dist/client/assets/custom-CSiS1liN.js +0 -1
|
@@ -306,3 +306,201 @@ class TestParseComponentEntryAndEndNodes:
|
|
|
306
306
|
|
|
307
307
|
with pytest.raises(ValueError, match="End nodes cannot be executed as standalone components"):
|
|
308
308
|
parse_component(node, basic_workflow)
|
|
309
|
+
|
|
310
|
+
|
|
311
|
+
class TestCodeNodeClassResolutionShapes:
|
|
312
|
+
"""Pin back-compat for the FF=off (legacy Python) Code node runtime.
|
|
313
|
+
|
|
314
|
+
PR #3483 shipped a new Studio default template (`class Code: def
|
|
315
|
+
__call__(self, ...): ...` — no `dspy.Module` inheritance). The Go
|
|
316
|
+
runtime's runner.py was updated to resolve __call__ / forward /
|
|
317
|
+
dspy.Module / top-level execute, but the Python parser only matched
|
|
318
|
+
`class X(dspy.Module):`. Result: customers still on the legacy
|
|
319
|
+
Python NLP path (FF=off) would hit
|
|
320
|
+
Could not find a class that inherits from dspy.Module for component Code
|
|
321
|
+
when running the new template.
|
|
322
|
+
|
|
323
|
+
These tests pin the resolution order in
|
|
324
|
+
`_resolve_code_class_name` so the Python side accepts the same
|
|
325
|
+
shapes the Go side does:
|
|
326
|
+
1. `class X(dspy.Module):` (legacy default — preferred)
|
|
327
|
+
2. `class X:` matching the node's normalized name
|
|
328
|
+
3. First `class X:` declaration (single-class file)
|
|
329
|
+
4. No class → clear error message listing supported shapes.
|
|
330
|
+
"""
|
|
331
|
+
|
|
332
|
+
def _make_code_node(self, code: str, name: str = "Code") -> CodeNode:
|
|
333
|
+
return CodeNode(
|
|
334
|
+
id="code_node",
|
|
335
|
+
data=Code(
|
|
336
|
+
name=name,
|
|
337
|
+
cls=name,
|
|
338
|
+
parameters=[
|
|
339
|
+
Field(
|
|
340
|
+
identifier="code",
|
|
341
|
+
type=FieldType.str,
|
|
342
|
+
optional=None,
|
|
343
|
+
value=code,
|
|
344
|
+
desc=None,
|
|
345
|
+
),
|
|
346
|
+
],
|
|
347
|
+
),
|
|
348
|
+
)
|
|
349
|
+
|
|
350
|
+
def test_class_with_dunder_call_only_no_dspy_inheritance(self):
|
|
351
|
+
"""The new default template — class with __call__, no dspy.Module."""
|
|
352
|
+
node = self._make_code_node(
|
|
353
|
+
"""
|
|
354
|
+
class Code:
|
|
355
|
+
def __call__(self, input: str):
|
|
356
|
+
return {"output": "Hello world!"}
|
|
357
|
+
"""
|
|
358
|
+
)
|
|
359
|
+
code, class_name, _ = parse_component(node, basic_workflow)
|
|
360
|
+
assert class_name == "Code"
|
|
361
|
+
with materialized_component_class(code, class_name) as Module:
|
|
362
|
+
instance = Module()
|
|
363
|
+
assert instance(input="anything") == {"output": "Hello world!"}
|
|
364
|
+
|
|
365
|
+
def test_class_with_forward_only_no_dspy_inheritance(self):
|
|
366
|
+
"""`forward()` shape without dspy.Module — must also work."""
|
|
367
|
+
node = self._make_code_node(
|
|
368
|
+
"""
|
|
369
|
+
class Code:
|
|
370
|
+
def forward(self, **kwargs):
|
|
371
|
+
return {"output": kwargs.get("input", "")}
|
|
372
|
+
"""
|
|
373
|
+
)
|
|
374
|
+
code, class_name, _ = parse_component(node, basic_workflow)
|
|
375
|
+
assert class_name == "Code"
|
|
376
|
+
with materialized_component_class(code, class_name) as Module:
|
|
377
|
+
instance = Module()
|
|
378
|
+
assert instance.forward(input="x") == {"output": "x"}
|
|
379
|
+
|
|
380
|
+
def test_legacy_dspy_module_subclass_still_resolves_first(self):
|
|
381
|
+
"""Existing customer code keeps working — back-compat anchor."""
|
|
382
|
+
node = self._make_code_node(
|
|
383
|
+
"""
|
|
384
|
+
import dspy
|
|
385
|
+
|
|
386
|
+
class Code(dspy.Module):
|
|
387
|
+
def forward(self, **kwargs):
|
|
388
|
+
return {"output": "legacy"}
|
|
389
|
+
""",
|
|
390
|
+
name="Code",
|
|
391
|
+
)
|
|
392
|
+
code, class_name, _ = parse_component(node, basic_workflow)
|
|
393
|
+
assert class_name == "Code"
|
|
394
|
+
with materialized_component_class(code, class_name) as Module:
|
|
395
|
+
assert issubclass(Module, dspy.Module)
|
|
396
|
+
|
|
397
|
+
def test_dspy_module_wins_over_helper_classes_above_it(self):
|
|
398
|
+
"""When the user defines helpers, the dspy.Module class is picked."""
|
|
399
|
+
node = self._make_code_node(
|
|
400
|
+
"""
|
|
401
|
+
import dspy
|
|
402
|
+
|
|
403
|
+
class Helper:
|
|
404
|
+
def __call__(self, x):
|
|
405
|
+
return x
|
|
406
|
+
|
|
407
|
+
class Code(dspy.Module):
|
|
408
|
+
def forward(self, **kwargs):
|
|
409
|
+
return {"output": "main"}
|
|
410
|
+
"""
|
|
411
|
+
)
|
|
412
|
+
_, class_name, _ = parse_component(node, basic_workflow)
|
|
413
|
+
# Despite Helper appearing first, the dspy.Module subclass wins.
|
|
414
|
+
assert class_name == "Code"
|
|
415
|
+
|
|
416
|
+
def test_node_name_disambiguates_when_no_dspy_inheritance(self):
|
|
417
|
+
"""Multiple bare classes — pick the one matching the node name."""
|
|
418
|
+
node = self._make_code_node(
|
|
419
|
+
"""
|
|
420
|
+
class Helper:
|
|
421
|
+
pass
|
|
422
|
+
|
|
423
|
+
class Code:
|
|
424
|
+
def __call__(self, input: str):
|
|
425
|
+
return {"output": "main"}
|
|
426
|
+
""",
|
|
427
|
+
name="Code",
|
|
428
|
+
)
|
|
429
|
+
_, class_name, _ = parse_component(node, basic_workflow)
|
|
430
|
+
assert class_name == "Code"
|
|
431
|
+
|
|
432
|
+
def test_no_class_in_code_raises_clear_error(self):
|
|
433
|
+
"""Helpful error replaces the misleading 'must inherit dspy.Module'.
|
|
434
|
+
|
|
435
|
+
Note: the Go runner accepts a top-level ``def execute(...)`` shape;
|
|
436
|
+
the Python parser intentionally does not (it's a class-name
|
|
437
|
+
extractor, not an instance resolver — see _resolve_code_class_name
|
|
438
|
+
docstring). The resulting message must point users at the
|
|
439
|
+
supported shapes so they convert their function into a class.
|
|
440
|
+
"""
|
|
441
|
+
node = self._make_code_node(
|
|
442
|
+
"""
|
|
443
|
+
def execute(input: str):
|
|
444
|
+
return {"output": "no class"}
|
|
445
|
+
"""
|
|
446
|
+
)
|
|
447
|
+
with pytest.raises(
|
|
448
|
+
ValueError,
|
|
449
|
+
match=r"Could not find a class definition.*Supported shapes",
|
|
450
|
+
):
|
|
451
|
+
parse_component(node, basic_workflow)
|
|
452
|
+
|
|
453
|
+
def test_class_with_multi_line_base_list_resolves(self):
|
|
454
|
+
"""Edge case Sarah flagged in #3543 review.
|
|
455
|
+
|
|
456
|
+
The class-declaration regex uses ``[^)]*`` for the base list,
|
|
457
|
+
which (unlike ``.``) matches newlines without re.DOTALL. So a
|
|
458
|
+
multi-line base list — common when the user pulls in mixins —
|
|
459
|
+
still resolves the class name correctly without falling through
|
|
460
|
+
to the no-class branch.
|
|
461
|
+
"""
|
|
462
|
+
node = self._make_code_node(
|
|
463
|
+
"""
|
|
464
|
+
import dspy
|
|
465
|
+
|
|
466
|
+
class Mixin:
|
|
467
|
+
pass
|
|
468
|
+
|
|
469
|
+
class Code(
|
|
470
|
+
dspy.Module,
|
|
471
|
+
Mixin,
|
|
472
|
+
):
|
|
473
|
+
def forward(self, **kwargs):
|
|
474
|
+
return {"output": "multi-base"}
|
|
475
|
+
"""
|
|
476
|
+
)
|
|
477
|
+
_, class_name, _ = parse_component(node, basic_workflow)
|
|
478
|
+
# AST-based discovery resolves dspy.Module-as-base correctly
|
|
479
|
+
# even with additional bases (the priority-1 path matches any
|
|
480
|
+
# class with dspy.Module among its bases, not only sole-base).
|
|
481
|
+
assert class_name == "Code"
|
|
482
|
+
|
|
483
|
+
def test_class_in_comment_or_docstring_is_not_picked(self):
|
|
484
|
+
"""CodeRabbit-flagged regression on #3543.
|
|
485
|
+
|
|
486
|
+
Regex-based discovery would happily pick `class Fake:` if it
|
|
487
|
+
appeared inside a string or comment, then fail at
|
|
488
|
+
`getattr(module, 'Fake')` with a confusing AttributeError. The
|
|
489
|
+
AST-based discovery only sees real top-level class declarations,
|
|
490
|
+
so the disguised class names are ignored.
|
|
491
|
+
"""
|
|
492
|
+
node = self._make_code_node(
|
|
493
|
+
'''
|
|
494
|
+
"""Module docstring with class Fake: nope, not a real class."""
|
|
495
|
+
|
|
496
|
+
# class Hidden: this is just a comment
|
|
497
|
+
SAMPLE = "class Decoy:\\n pass"
|
|
498
|
+
|
|
499
|
+
class Code:
|
|
500
|
+
def __call__(self, input: str):
|
|
501
|
+
return {"output": "real"}
|
|
502
|
+
''',
|
|
503
|
+
name="Code",
|
|
504
|
+
)
|
|
505
|
+
_, class_name, _ = parse_component(node, basic_workflow)
|
|
506
|
+
assert class_name == "Code"
|
|
@@ -31,7 +31,7 @@ importers:
|
|
|
31
31
|
version: 1.1.0
|
|
32
32
|
vitest:
|
|
33
33
|
specifier: ^3.2.4
|
|
34
|
-
version: 3.2.4(@types/debug@4.1.
|
|
34
|
+
version: 3.2.4(@types/debug@4.1.13)(@types/node@16.18.126)(tsx@4.20.5)(yaml@2.8.3)
|
|
35
35
|
yargs:
|
|
36
36
|
specifier: ^17.7.2
|
|
37
37
|
version: 17.7.2
|
|
@@ -53,10 +53,10 @@ importers:
|
|
|
53
53
|
version: 9.39.2
|
|
54
54
|
'@langwatch/scenario':
|
|
55
55
|
specifier: ^0.4.6
|
|
56
|
-
version: 0.4.10(
|
|
56
|
+
version: 0.4.10(325f2ac55009fad6e2acd26ed8f33b8a)
|
|
57
57
|
'@types/debug':
|
|
58
58
|
specifier: ^4.1.12
|
|
59
|
-
version: 4.1.
|
|
59
|
+
version: 4.1.13
|
|
60
60
|
'@types/eslint__js':
|
|
61
61
|
specifier: ^8.42.3
|
|
62
62
|
version: 8.42.3
|
|
@@ -77,7 +77,7 @@ importers:
|
|
|
77
77
|
version: 6.0.116(zod@4.3.6)
|
|
78
78
|
dotenv:
|
|
79
79
|
specifier: ^17.2.2
|
|
80
|
-
version: 17.
|
|
80
|
+
version: 17.4.2
|
|
81
81
|
esbuild:
|
|
82
82
|
specifier: ^0.25.0
|
|
83
83
|
version: 0.25.0
|
|
@@ -1340,8 +1340,8 @@ packages:
|
|
|
1340
1340
|
'@types/connect@3.4.38':
|
|
1341
1341
|
resolution: {integrity: sha512-K6uROf1LD88uDQqJCktA4yzL1YYAK6NgfsI0v/mTgyPKWsX1CnJ0XPSDhViejru1GcRkLWb8RlzFYJRqGUbaug==}
|
|
1342
1342
|
|
|
1343
|
-
'@types/debug@4.1.
|
|
1344
|
-
resolution: {integrity: sha512-
|
|
1343
|
+
'@types/debug@4.1.13':
|
|
1344
|
+
resolution: {integrity: sha512-KSVgmQmzMwPlmtljOomayoR89W4FynCAi3E8PPs7vmDVPe84hT+vGPKkJfThkmXs0x0jAaa9U8uW8bbfyS2fWw==}
|
|
1345
1345
|
|
|
1346
1346
|
'@types/deep-eql@4.0.2':
|
|
1347
1347
|
resolution: {integrity: sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw==}
|
|
@@ -1814,12 +1814,8 @@ packages:
|
|
|
1814
1814
|
resolution: {integrity: sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==}
|
|
1815
1815
|
engines: {node: '>= 0.8'}
|
|
1816
1816
|
|
|
1817
|
-
dotenv@17.
|
|
1818
|
-
resolution: {integrity: sha512-
|
|
1819
|
-
engines: {node: '>=12'}
|
|
1820
|
-
|
|
1821
|
-
dotenv@17.4.1:
|
|
1822
|
-
resolution: {integrity: sha512-k8DaKGP6r1G30Lx8V4+pCsLzKr8vLmV2paqEj1Y55GdAgJuIqpRp5FfajGF8KtwMxCz9qJc6wUIJnm053d/WCw==}
|
|
1817
|
+
dotenv@17.4.2:
|
|
1818
|
+
resolution: {integrity: sha512-nI4U3TottKAcAD9LLud4Cb7b2QztQMUEfHbvhTH09bqXTxnSie8WnjPALV/WMCrJZ6UV/qHJ6L03OqO3LcdYZw==}
|
|
1823
1819
|
engines: {node: '>=12'}
|
|
1824
1820
|
|
|
1825
1821
|
dunder-proto@1.0.1:
|
|
@@ -3482,7 +3478,7 @@ snapshots:
|
|
|
3482
3478
|
'@langchain/core': 0.3.80(@opentelemetry/api@1.9.1)(@opentelemetry/exporter-trace-otlp-proto@0.215.0(@opentelemetry/api@1.9.1))(@opentelemetry/sdk-trace-base@2.7.0(@opentelemetry/api@1.9.1))(openai@6.34.0(ws@8.20.0)(zod@4.3.6))
|
|
3483
3479
|
js-tiktoken: 1.0.21
|
|
3484
3480
|
|
|
3485
|
-
'@langwatch/scenario@0.4.10(
|
|
3481
|
+
'@langwatch/scenario@0.4.10(325f2ac55009fad6e2acd26ed8f33b8a)':
|
|
3486
3482
|
dependencies:
|
|
3487
3483
|
'@ag-ui/core': 0.0.28
|
|
3488
3484
|
'@ai-sdk/openai': 3.0.52(zod@3.25.76)
|
|
@@ -3493,7 +3489,7 @@ snapshots:
|
|
|
3493
3489
|
langwatch: 0.16.1(7c67c605ee5bfbd7a8d8f9918c809a56)
|
|
3494
3490
|
open: 11.0.0
|
|
3495
3491
|
rxjs: 7.8.2
|
|
3496
|
-
vitest: 3.2.4(@types/debug@4.1.
|
|
3492
|
+
vitest: 3.2.4(@types/debug@4.1.13)(@types/node@16.18.126)(tsx@4.20.5)(yaml@2.8.3)
|
|
3497
3493
|
xksuid: 0.0.4
|
|
3498
3494
|
zod: 3.25.76
|
|
3499
3495
|
transitivePeerDependencies:
|
|
@@ -4333,7 +4329,7 @@ snapshots:
|
|
|
4333
4329
|
dependencies:
|
|
4334
4330
|
'@types/node': 16.18.126
|
|
4335
4331
|
|
|
4336
|
-
'@types/debug@4.1.
|
|
4332
|
+
'@types/debug@4.1.13':
|
|
4337
4333
|
dependencies:
|
|
4338
4334
|
'@types/ms': 2.1.0
|
|
4339
4335
|
|
|
@@ -4801,9 +4797,7 @@ snapshots:
|
|
|
4801
4797
|
|
|
4802
4798
|
depd@2.0.0: {}
|
|
4803
4799
|
|
|
4804
|
-
dotenv@17.
|
|
4805
|
-
|
|
4806
|
-
dotenv@17.4.1: {}
|
|
4800
|
+
dotenv@17.4.2: {}
|
|
4807
4801
|
|
|
4808
4802
|
dunder-proto@1.0.1:
|
|
4809
4803
|
dependencies:
|
|
@@ -5287,7 +5281,7 @@ snapshots:
|
|
|
5287
5281
|
'@types/prompts': 2.4.9
|
|
5288
5282
|
chalk: 4.1.2
|
|
5289
5283
|
commander: 12.1.0
|
|
5290
|
-
dotenv: 17.4.
|
|
5284
|
+
dotenv: 17.4.2
|
|
5291
5285
|
js-yaml: 4.1.1
|
|
5292
5286
|
langchain: 0.3.37(@langchain/core@0.3.80(@opentelemetry/api@1.9.1)(@opentelemetry/exporter-trace-otlp-proto@0.215.0(@opentelemetry/api@1.9.1))(@opentelemetry/sdk-trace-base@2.7.0(@opentelemetry/api@1.9.1))(openai@6.34.0(ws@8.20.0)(zod@4.3.6)))(@opentelemetry/api@1.9.1)(@opentelemetry/exporter-trace-otlp-proto@0.215.0(@opentelemetry/api@1.9.1))(@opentelemetry/sdk-trace-base@2.7.0(@opentelemetry/api@1.9.1))(openai@6.34.0(ws@8.20.0)(zod@4.3.6))(ws@8.20.0)
|
|
5293
5287
|
liquidjs: 10.25.5
|
|
@@ -5968,7 +5962,7 @@ snapshots:
|
|
|
5968
5962
|
tsx: 4.20.5
|
|
5969
5963
|
yaml: 2.8.3
|
|
5970
5964
|
|
|
5971
|
-
vitest@3.2.4(@types/debug@4.1.
|
|
5965
|
+
vitest@3.2.4(@types/debug@4.1.13)(@types/node@16.18.126)(tsx@4.20.5)(yaml@2.8.3):
|
|
5972
5966
|
dependencies:
|
|
5973
5967
|
'@types/chai': 5.2.2
|
|
5974
5968
|
'@vitest/expect': 3.2.4
|
|
@@ -5994,7 +5988,7 @@ snapshots:
|
|
|
5994
5988
|
vite-node: 3.2.4(@types/node@16.18.126)(tsx@4.20.5)(yaml@2.8.3)
|
|
5995
5989
|
why-is-node-running: 2.3.0
|
|
5996
5990
|
optionalDependencies:
|
|
5997
|
-
'@types/debug': 4.1.
|
|
5991
|
+
'@types/debug': 4.1.13
|
|
5998
5992
|
'@types/node': 16.18.126
|
|
5999
5993
|
transitivePeerDependencies:
|
|
6000
5994
|
- jiti
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@langwatch/server",
|
|
3
|
-
"version": "3.1.0-beta.
|
|
3
|
+
"version": "3.1.0-beta.23",
|
|
4
4
|
"description": "Run LangWatch locally with one command — `npx @langwatch/server`. Complete LangWatch stack: observability, evaluations, AI gateway, agent simulations.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://langwatch.ai",
|