langwatch 0.2.6__py3-none-any.whl → 0.2.8__py3-none-any.whl
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.
- langwatch/__version__.py +1 -1
- langwatch/dspy/__init__.py +19 -4
- langwatch/evaluation/__init__.py +3 -2
- langwatch/evaluation/evaluation.py +2 -2
- {langwatch-0.2.6.dist-info → langwatch-0.2.8.dist-info}/METADATA +1 -1
- {langwatch-0.2.6.dist-info → langwatch-0.2.8.dist-info}/RECORD +7 -7
- {langwatch-0.2.6.dist-info → langwatch-0.2.8.dist-info}/WHEEL +0 -0
langwatch/__version__.py
CHANGED
langwatch/dspy/__init__.py
CHANGED
|
@@ -9,7 +9,6 @@ from langwatch.utils.transformation import truncate_object_recursively
|
|
|
9
9
|
from langwatch.telemetry.tracing import LangWatchTrace
|
|
10
10
|
from typing_extensions import TypedDict
|
|
11
11
|
import langwatch
|
|
12
|
-
from langwatch.state import get_api_key, get_endpoint
|
|
13
12
|
import httpx
|
|
14
13
|
import json
|
|
15
14
|
from pydantic import BaseModel
|
|
@@ -21,6 +20,7 @@ from dspy.teleprompt import (
|
|
|
21
20
|
COPRO,
|
|
22
21
|
MIPROv2,
|
|
23
22
|
)
|
|
23
|
+
import dspy.teleprompt.copro_optimizer as copro_optimizer
|
|
24
24
|
from dspy.signatures.signature import SignatureMeta
|
|
25
25
|
from dspy.primitives.prediction import Prediction, Completions
|
|
26
26
|
from dspy.primitives.example import Example
|
|
@@ -521,7 +521,15 @@ class LangWatchTrackedCOPRO(COPRO):
|
|
|
521
521
|
|
|
522
522
|
@contextmanager
|
|
523
523
|
def _patch_logger_and_evaluate(self):
|
|
524
|
-
|
|
524
|
+
legacy_logger = True
|
|
525
|
+
original_logger_info = None
|
|
526
|
+
|
|
527
|
+
if hasattr(copro_optimizer, "logger"):
|
|
528
|
+
legacy_logger = False
|
|
529
|
+
original_logger_info = copro_optimizer.logger.info
|
|
530
|
+
else:
|
|
531
|
+
original_logger_info = dspy.logger.info
|
|
532
|
+
|
|
525
533
|
original_evaluate_call = Evaluate.__call__
|
|
526
534
|
step = None
|
|
527
535
|
scores = []
|
|
@@ -577,13 +585,20 @@ class LangWatchTrackedCOPRO(COPRO):
|
|
|
577
585
|
|
|
578
586
|
return score
|
|
579
587
|
|
|
580
|
-
|
|
588
|
+
if legacy_logger:
|
|
589
|
+
dspy.logger.info = patched_logger_info
|
|
590
|
+
else:
|
|
591
|
+
copro_optimizer.logger.info = patched_logger_info
|
|
592
|
+
|
|
581
593
|
Evaluate.__call__ = patched_evaluate_call
|
|
582
594
|
|
|
583
595
|
try:
|
|
584
596
|
yield
|
|
585
597
|
finally:
|
|
586
|
-
|
|
598
|
+
if legacy_logger:
|
|
599
|
+
dspy.logger.info = original_logger_info
|
|
600
|
+
else:
|
|
601
|
+
copro_optimizer.logger.info = original_logger_info
|
|
587
602
|
Evaluate.__call__ = original_evaluate_call
|
|
588
603
|
|
|
589
604
|
|
langwatch/evaluation/__init__.py
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
from typing import Optional
|
|
1
2
|
from langwatch.evaluation.evaluation import Evaluation
|
|
2
3
|
from .evaluation import Evaluation
|
|
3
4
|
|
|
4
5
|
|
|
5
|
-
def init(name: str) -> Evaluation:
|
|
6
|
-
evaluation = Evaluation(name)
|
|
6
|
+
def init(name: str, *, run_id: Optional[str] = None) -> Evaluation:
|
|
7
|
+
evaluation = Evaluation(name, run_id=run_id)
|
|
7
8
|
evaluation.init()
|
|
8
9
|
return evaluation
|
|
@@ -93,10 +93,10 @@ class Evaluation:
|
|
|
93
93
|
_current_index: int
|
|
94
94
|
_current_item: Any
|
|
95
95
|
|
|
96
|
-
def __init__(self, name: str):
|
|
96
|
+
def __init__(self, name: str, *, run_id: Optional[str] = None):
|
|
97
97
|
self.name: str = name or generate_slug(3)
|
|
98
98
|
self.experiment_slug: str = self.name
|
|
99
|
-
self.run_id: str = generate_slug(3)
|
|
99
|
+
self.run_id: str = run_id or generate_slug(3)
|
|
100
100
|
self.total: int = 0
|
|
101
101
|
self.progress: int = 0
|
|
102
102
|
self.created_at_nano: int = int(time.time() * 1000)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
langwatch/__init__.py,sha256=nepKSqGG6MQnLgn3QrzcAQ24wlXc-wBAcS0Ks7oVUKk,3681
|
|
2
|
-
langwatch/__version__.py,sha256=
|
|
2
|
+
langwatch/__version__.py,sha256=fVjSxPE9TfkSdSWhP2pKjFKPW2e6jMivB_7HF8_G-3Y,64
|
|
3
3
|
langwatch/attributes.py,sha256=VsNstyDPaMIjsM4U7yAIDE7ouVxgwhOdbQlrhce9XU8,3699
|
|
4
4
|
langwatch/batch_evaluation.py,sha256=cZ_OxDEpZhwVQap8fub3vcdWVYw9OdUCg7WTuy5FgoY,15748
|
|
5
5
|
langwatch/client.py,sha256=w-WkYRwgFMlfljAwcR6GBT11kBQOc3Ifb3hGY1htOd4,13156
|
|
@@ -15,9 +15,9 @@ langwatch/tracer.py,sha256=t5FOdP1es9H_pPGqGUBLXCyEln0tTi4m4M9b6WxCrPU,975
|
|
|
15
15
|
langwatch/types.py,sha256=DkZThS7ptUY0_Ao7PNO6ZGBE9Qj0YmJf5auRkq2Cphw,2570
|
|
16
16
|
langwatch/dataset/__init__.py,sha256=1vUqnyFymnzcIOTahtsPvKTyAet_q-HTKByRUkuED80,2290
|
|
17
17
|
langwatch/domain/__init__.py,sha256=luuin3-6mmMqDaOJE_1wb7M1ccjhhZL80UN0TBA_TXM,6040
|
|
18
|
-
langwatch/dspy/__init__.py,sha256=
|
|
19
|
-
langwatch/evaluation/__init__.py,sha256=
|
|
20
|
-
langwatch/evaluation/evaluation.py,sha256=
|
|
18
|
+
langwatch/dspy/__init__.py,sha256=VQoriSl0Um4A0K3dbYxj6ZLUqNLgKKyODd3vkVp0wD4,32027
|
|
19
|
+
langwatch/evaluation/__init__.py,sha256=Jy7PW5VQbMoDGdOLRlQmDEvo_9TDkBLmrLrfocxddLM,281
|
|
20
|
+
langwatch/evaluation/evaluation.py,sha256=AF3VXCcTGB3F8ChsjwBxqjUXkLzvTbkWbiWYxRzVWik,16037
|
|
21
21
|
langwatch/exporters/filterable_batch_span_exporter.py,sha256=MlhZjui56XD6p2sa8kEGyr-Hb3wqudknngmemnB4Twg,2142
|
|
22
22
|
langwatch/generated/langwatch_rest_api_client/__init__.py,sha256=8r-9pAj7fK7vnVX3mT0y_zS4B9ZRqD6RZiBo5fPra60,156
|
|
23
23
|
langwatch/generated/langwatch_rest_api_client/client.py,sha256=o_mdLqyBCQstu5tS1WZFwqIEbGwkvWQ7eQjuCJw_5VY,12419
|
|
@@ -216,6 +216,6 @@ langwatch/utils/initialization.py,sha256=LOmGCiox7JRiHprnB04AdO8BhUggZtRbWgBPF9m
|
|
|
216
216
|
langwatch/utils/module.py,sha256=KLBNOK3mA9gCSifCcQX_lOtU48BJQDWvFKtF6NMvwVA,688
|
|
217
217
|
langwatch/utils/transformation.py,sha256=5XUnW7Oz8Ck9EMsKeKeoDOrIw3EXpLGMk_fMSeA0Zng,7216
|
|
218
218
|
langwatch/utils/utils.py,sha256=ZCOSie4o9LdJ7odshNfCNjmgwgQ27ojc5ENqt1rXuSs,596
|
|
219
|
-
langwatch-0.2.
|
|
220
|
-
langwatch-0.2.
|
|
221
|
-
langwatch-0.2.
|
|
219
|
+
langwatch-0.2.8.dist-info/METADATA,sha256=1M8Yyf8TEbm7UWcUkNPGMiFcvGFTb1y_eRn3whPdfKQ,12886
|
|
220
|
+
langwatch-0.2.8.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
221
|
+
langwatch-0.2.8.dist-info/RECORD,,
|
|
File without changes
|