langtrace-python-sdk 3.8.13__py3-none-any.whl → 3.8.15__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.
- examples/dspy_example/QA_basic.py +2 -2
- examples/dspy_example/QA_basic_with_chain_of_thought.py +2 -2
- examples/dspy_example/QA_basic_with_signature.py +2 -2
- examples/dspy_example/QA_multi_step_with_chain_of_thought.py +2 -2
- examples/dspy_example/math_problems_cot.py +2 -2
- examples/dspy_example/math_problems_cot_parallel.py +2 -2
- examples/dspy_example/program_of_thought_basic.py +2 -2
- examples/dspy_example/react.py +2 -2
- langtrace_python_sdk/instrumentation/cleanlab/patch.py +4 -0
- langtrace_python_sdk/instrumentation/dspy/instrumentation.py +0 -5
- langtrace_python_sdk/instrumentation/dspy/patch.py +1 -1
- langtrace_python_sdk/langtrace.py +24 -1
- langtrace_python_sdk/version.py +1 -1
- {langtrace_python_sdk-3.8.13.dist-info → langtrace_python_sdk-3.8.15.dist-info}/METADATA +1 -1
- {langtrace_python_sdk-3.8.13.dist-info → langtrace_python_sdk-3.8.15.dist-info}/RECORD +18 -18
- {langtrace_python_sdk-3.8.13.dist-info → langtrace_python_sdk-3.8.15.dist-info}/WHEEL +0 -0
- {langtrace_python_sdk-3.8.13.dist-info → langtrace_python_sdk-3.8.15.dist-info}/entry_points.txt +0 -0
- {langtrace_python_sdk-3.8.13.dist-info → langtrace_python_sdk-3.8.15.dist-info}/licenses/LICENSE +0 -0
@@ -8,8 +8,8 @@ langtrace.init(disable_instrumentations={"all_except": ["dspy", "anthropic"]})
|
|
8
8
|
|
9
9
|
# configure the language model to be used by dspy
|
10
10
|
|
11
|
-
|
12
|
-
dspy.
|
11
|
+
lm = dspy.LM('claude-3-opus-20240229')
|
12
|
+
dspy.configure(lm=lm)
|
13
13
|
|
14
14
|
# create a prompt format that says that the llm will take a question and give back an answer
|
15
15
|
predict = dspy.Predict("question -> answer")
|
@@ -7,8 +7,8 @@ load_dotenv()
|
|
7
7
|
langtrace.init(disable_instrumentations={"all_except": ["dspy", "anthropic"]})
|
8
8
|
|
9
9
|
# configure the language model to be used by dspy
|
10
|
-
|
11
|
-
dspy.
|
10
|
+
lm = dspy.LM('claude-3-opus-20240229')
|
11
|
+
dspy.configure(lm=lm)
|
12
12
|
|
13
13
|
|
14
14
|
# create a signature for basic question answering
|
@@ -7,8 +7,8 @@ load_dotenv()
|
|
7
7
|
langtrace.init(disable_instrumentations={"all_except": ["dspy", "anthropic"]})
|
8
8
|
|
9
9
|
# configure the language model to be used by dspy
|
10
|
-
|
11
|
-
dspy.
|
10
|
+
lm = dspy.LM('claude-3-opus-20240229')
|
11
|
+
dspy.configure(lm=lm)
|
12
12
|
|
13
13
|
|
14
14
|
# create a signature for basic question answering
|
@@ -7,8 +7,8 @@ load_dotenv()
|
|
7
7
|
langtrace.init(disable_instrumentations={"all_except": ["dspy", "anthropic"]})
|
8
8
|
|
9
9
|
# configure the language model to be used by dspy
|
10
|
-
|
11
|
-
dspy.
|
10
|
+
lm = dspy.LM('claude-3-opus-20240229')
|
11
|
+
dspy.configure(lm=lm)
|
12
12
|
|
13
13
|
|
14
14
|
# create a signature for basic question answering
|
@@ -7,8 +7,8 @@ from langtrace_python_sdk import langtrace, with_langtrace_root_span
|
|
7
7
|
|
8
8
|
langtrace.init()
|
9
9
|
|
10
|
-
|
11
|
-
dspy.
|
10
|
+
lm = dspy.LM('gpt-3.5-turbo')
|
11
|
+
dspy.configure(lm=lm)
|
12
12
|
|
13
13
|
# Load math questions from the GSM8K dataset
|
14
14
|
gsm8k = GSM8K()
|
@@ -9,8 +9,8 @@ from langtrace_python_sdk import langtrace, with_langtrace_root_span, inject_add
|
|
9
9
|
|
10
10
|
langtrace.init()
|
11
11
|
|
12
|
-
|
13
|
-
dspy.
|
12
|
+
lm = dspy.LM('gpt-3.5-turbo')
|
13
|
+
dspy.configure(lm=lm)
|
14
14
|
|
15
15
|
# Load math questions from the GSM8K dataset
|
16
16
|
gsm8k = GSM8K()
|
@@ -5,8 +5,8 @@ from langtrace_python_sdk import langtrace, with_langtrace_root_span
|
|
5
5
|
|
6
6
|
langtrace.init()
|
7
7
|
|
8
|
-
|
9
|
-
dspy.
|
8
|
+
lm = dspy.LM('gpt-3.5-turbo')
|
9
|
+
dspy.configure(lm=lm)
|
10
10
|
|
11
11
|
|
12
12
|
# Define a simple signature for basic question answering
|
examples/dspy_example/react.py
CHANGED
@@ -15,8 +15,8 @@ from langtrace_python_sdk import langtrace, with_langtrace_root_span
|
|
15
15
|
|
16
16
|
langtrace.init()
|
17
17
|
|
18
|
-
|
19
|
-
dspy.
|
18
|
+
lm = dspy.LM('gpt-3.5-turbo')
|
19
|
+
dspy.configure(lm=lm)
|
20
20
|
|
21
21
|
colbertv2_wiki17_abstracts = dspy.ColBERTv2(
|
22
22
|
url="http://20.102.90.50:2017/wiki17_abstracts"
|
@@ -63,6 +63,10 @@ def generic_patch(version: str, tracer: Tracer) -> Callable:
|
|
63
63
|
result_json = str(result)
|
64
64
|
|
65
65
|
span.set_attribute("tlm.result", str(result_json))
|
66
|
+
trustworthiness_score = result_json["trustworthiness_score"]
|
67
|
+
log = result_json["log"]
|
68
|
+
span.set_attribute("tlm.trustworthiness_score", str(trustworthiness_score))
|
69
|
+
span.set_attribute("tlm.explanation", str(log.get("explanation", "")))
|
66
70
|
span.set_status(Status(StatusCode.OK))
|
67
71
|
|
68
72
|
return result
|
@@ -70,11 +70,6 @@ class DspyInstrumentation(BaseInstrumentor):
|
|
70
70
|
"MultiChainComparison.forward",
|
71
71
|
patch_signature("MultiChainComparison.forward", version, tracer),
|
72
72
|
)
|
73
|
-
_W(
|
74
|
-
"dspy.predict.retry",
|
75
|
-
"Retry.forward",
|
76
|
-
patch_signature("Retry.forward", version, tracer),
|
77
|
-
)
|
78
73
|
_W(
|
79
74
|
"dspy.evaluate.evaluate",
|
80
75
|
"Evaluate.__call__",
|
@@ -38,7 +38,7 @@ def patch_bootstrapfewshot_optimizer(operation_name, version, tracer):
|
|
38
38
|
prog = {
|
39
39
|
"name": args[0].prog.__class__.__name__,
|
40
40
|
"signature": (
|
41
|
-
str(args[0].prog.signature) if args[0].prog
|
41
|
+
str(args[0].prog.signature) if hasattr(args[0].prog, "signature") else None
|
42
42
|
),
|
43
43
|
}
|
44
44
|
span_attributes["dspy.optimizer.module.prog"] = json.dumps(prog)
|
@@ -205,7 +205,30 @@ def add_span_processor(provider: TracerProvider, config: LangtraceConfig, export
|
|
205
205
|
)
|
206
206
|
else:
|
207
207
|
provider.add_span_processor(BatchSpanProcessor(exporter))
|
208
|
-
|
208
|
+
project = get_project(config)
|
209
|
+
if project:
|
210
|
+
print(Fore.BLUE + f"Exporting spans to {project['name']}.." + Fore.RESET)
|
211
|
+
print(
|
212
|
+
Fore.BLUE
|
213
|
+
+ f"Langtrace Project URL: {LANGTRACE_REMOTE_URL}/project/{project['id']}/traces"
|
214
|
+
+ Fore.RESET
|
215
|
+
)
|
216
|
+
else:
|
217
|
+
print(Fore.BLUE + "Exporting spans to Langtrace cloud.." + Fore.RESET)
|
218
|
+
|
219
|
+
|
220
|
+
def get_project(config: LangtraceConfig):
|
221
|
+
import requests
|
222
|
+
|
223
|
+
try:
|
224
|
+
|
225
|
+
response = requests.get(
|
226
|
+
f"{LANGTRACE_REMOTE_URL}/api/project",
|
227
|
+
headers={"x-api-key": config.api_key},
|
228
|
+
)
|
229
|
+
return response.json()["project"]
|
230
|
+
except Exception as error:
|
231
|
+
return None
|
209
232
|
|
210
233
|
|
211
234
|
def init_sentry(config: LangtraceConfig, host: str):
|
langtrace_python_sdk/version.py
CHANGED
@@ -1 +1 @@
|
|
1
|
-
__version__ = "3.8.
|
1
|
+
__version__ = "3.8.15"
|
@@ -39,15 +39,15 @@ examples/crewai_example/trip_planner/main.py,sha256=dwEh60RABqaBodhkPr3lB7KS83f7
|
|
39
39
|
examples/crewai_example/trip_planner/tasks.py,sha256=ZGRaTAgkA66IN7q9EYbJqM8xWhUTxcF4ynnqTyBcSL4,5667
|
40
40
|
examples/crewai_example/trip_planner/tools/calculator.py,sha256=bMfxJDAwbn6D26pe880S4BB3rcFeyvEyb15QR00T8kI,522
|
41
41
|
examples/crewai_example/trip_planner/tools/search_tools.py,sha256=p8qZe_bi45OjBwiwwrH0lhTaQI_ZiLThSTEEN5dWxF0,2700
|
42
|
-
examples/dspy_example/QA_basic.py,sha256=
|
43
|
-
examples/dspy_example/QA_basic_with_chain_of_thought.py,sha256=
|
44
|
-
examples/dspy_example/QA_basic_with_signature.py,sha256=
|
45
|
-
examples/dspy_example/QA_multi_step_with_chain_of_thought.py,sha256=
|
46
|
-
examples/dspy_example/math_problems_cot.py,sha256=
|
47
|
-
examples/dspy_example/math_problems_cot_parallel.py,sha256=
|
48
|
-
examples/dspy_example/program_of_thought_basic.py,sha256=
|
42
|
+
examples/dspy_example/QA_basic.py,sha256=dNEDgooB8sva8hiAMDH6WZXcHrro8CEoGw4zDKV8HH8,562
|
43
|
+
examples/dspy_example/QA_basic_with_chain_of_thought.py,sha256=GBhVftBPhw9QZqhLADaZgfQZHyKgeSCjxDQ_d0ivlf4,823
|
44
|
+
examples/dspy_example/QA_basic_with_signature.py,sha256=nF1jLO0-Z35oDRoVsnru0NotBjH0ZDIvRgTdv1ahB_8,899
|
45
|
+
examples/dspy_example/QA_multi_step_with_chain_of_thought.py,sha256=67o-Ol7AMXEjWrTFt0vcEWLxxMiotYG31u5IzWdoack,1391
|
46
|
+
examples/dspy_example/math_problems_cot.py,sha256=czYlfKVvzyocorgGf14J4nUJoEzyWqjdFda056Y6DI0,1241
|
47
|
+
examples/dspy_example/math_problems_cot_parallel.py,sha256=xDKTWYuhtgj8pJViEl4GoGQShF1B0iFhsmXAYqBrnL8,1723
|
48
|
+
examples/dspy_example/program_of_thought_basic.py,sha256=uk5O-xQPNoOOPku3jarHdMZmlGTaJpKE7kaicnuemTM,943
|
49
49
|
examples/dspy_example/quiz_gen.py,sha256=OyGhepeX8meKOtLdmlYUjMD2ECk-ZQuQXUZif1hFQY4,3371
|
50
|
-
examples/dspy_example/react.py,sha256=
|
50
|
+
examples/dspy_example/react.py,sha256=PAye54eHzv2ATSvV6xnUnL9CvNrSO3rMzJZZFMvlOio,1335
|
51
51
|
examples/dspy_example/optimizers/bootstrap_fewshot.py,sha256=IxJJIaPKowP0-iZSuviKQnhc0bLj0_46cO13O9vLAlc,3135
|
52
52
|
examples/embedchain_example/simple.py,sha256=1lwnsh5wVjGjQ18OinID6aJ_itR-x0TOngtNU1E-Emc,373
|
53
53
|
examples/fastapi_example/__init__.py,sha256=INIfvJP7zC_KkJCtulS1qbh61-MJTPAHnzAgzeKi0yU,87
|
@@ -120,8 +120,8 @@ examples/vertexai_example/main.py,sha256=gndId5X5ksD-ycxnAWMdEqIDbLc3kz5Vt8vm4YP
|
|
120
120
|
examples/weaviate_example/__init__.py,sha256=8JMDBsRSEV10HfTd-YC7xb4txBjD3la56snk-Bbg2Kw,618
|
121
121
|
examples/weaviate_example/query_text.py,sha256=wPHQTc_58kPoKTZMygVjTj-2ZcdrIuaausJfMxNQnQc,127162
|
122
122
|
langtrace_python_sdk/__init__.py,sha256=VZM6i71NR7pBQK6XvJWRelknuTYUhqwqE7PlicKa5Wg,1166
|
123
|
-
langtrace_python_sdk/langtrace.py,sha256=
|
124
|
-
langtrace_python_sdk/version.py,sha256=
|
123
|
+
langtrace_python_sdk/langtrace.py,sha256=JYBCbklWv463lzRUH7pfkHAVoc3YHh-q_2Iv6LZ2HhU,14896
|
124
|
+
langtrace_python_sdk/version.py,sha256=zVdntVJdm-11j_n2E2RXCsklIAlpwHH2GJDDprZvteg,23
|
125
125
|
langtrace_python_sdk/constants/__init__.py,sha256=3CNYkWMdd1DrkGqzLUgNZXjdAlM6UFMlf_F-odAToyc,146
|
126
126
|
langtrace_python_sdk/constants/exporter/langtrace_exporter.py,sha256=EVCrouYCpY98f0KSaKr4PzNxPULTZZO6dSA_crEOyJU,106
|
127
127
|
langtrace_python_sdk/constants/instrumentation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -171,7 +171,7 @@ langtrace_python_sdk/instrumentation/chroma/instrumentation.py,sha256=nT6PS6bsrI
|
|
171
171
|
langtrace_python_sdk/instrumentation/chroma/patch.py,sha256=jYcqBeu-0cYA29PO880oXYRwYh-R1oseXmzfK6UDBps,9074
|
172
172
|
langtrace_python_sdk/instrumentation/cleanlab/__init__.py,sha256=UuwRiRAPH2i6cucqK8CgNYOGrsG4t_SGAQJSExRuZ1U,99
|
173
173
|
langtrace_python_sdk/instrumentation/cleanlab/instrumentation.py,sha256=CtWdtDUCqh60HU2Vs38O9Y32rlB4jzHIEbVRbwIf_Wg,2088
|
174
|
-
langtrace_python_sdk/instrumentation/cleanlab/patch.py,sha256=
|
174
|
+
langtrace_python_sdk/instrumentation/cleanlab/patch.py,sha256=RuBW7Qty4er1D9XqBntgUv5phmiiXtGARU09x4j-jGA,3451
|
175
175
|
langtrace_python_sdk/instrumentation/cohere/__init__.py,sha256=sGUSLdTUyYf36Tm6L5jQflhzCqvmWrhnBOMYHjvp6Hs,95
|
176
176
|
langtrace_python_sdk/instrumentation/cohere/instrumentation.py,sha256=1wxMhWMfsvKprdV52BIfCZhZS1beRYBW9rUzUDDkyCk,2854
|
177
177
|
langtrace_python_sdk/instrumentation/cohere/patch.py,sha256=qeXm4ycnXfDO7lxWrpA2GaUIvGTkLcSMiq9-xMtlP6U,25782
|
@@ -182,8 +182,8 @@ langtrace_python_sdk/instrumentation/crewai_tools/__init__.py,sha256=4aINgRu-2FZ
|
|
182
182
|
langtrace_python_sdk/instrumentation/crewai_tools/instrumentation.py,sha256=eqvnRu6ycPyjqYg5Vb4-QKPXVfBEzJQjZ7-MPUOyfOQ,1617
|
183
183
|
langtrace_python_sdk/instrumentation/crewai_tools/patch.py,sha256=HbqvxUizo20zYY_iP1-5MFYKp3S_QegIa5Glg7ht2i8,2602
|
184
184
|
langtrace_python_sdk/instrumentation/dspy/__init__.py,sha256=tM1srfi_QgyCzrde4izojMrRq2Wm7Dj5QUvVQXIJzkk,84
|
185
|
-
langtrace_python_sdk/instrumentation/dspy/instrumentation.py,sha256=
|
186
|
-
langtrace_python_sdk/instrumentation/dspy/patch.py,sha256=
|
185
|
+
langtrace_python_sdk/instrumentation/dspy/instrumentation.py,sha256=R8NDQlaalCfahTolzTZzRiq452MllF-vm_AEQ2IBZbw,2775
|
186
|
+
langtrace_python_sdk/instrumentation/dspy/patch.py,sha256=U-gIQ6gfwmvosCrhuBd4DGas-LHQXYoczd4rxB0xwRA,10233
|
187
187
|
langtrace_python_sdk/instrumentation/embedchain/__init__.py,sha256=5L6n8-brMnRWZ0CMmHEuN1mrhIxrYLNtxRy0Ujc-hOY,103
|
188
188
|
langtrace_python_sdk/instrumentation/embedchain/instrumentation.py,sha256=dShwm0duy25IvL7g9I_v-2oYuyh2fadeiJqXtXBay-8,1987
|
189
189
|
langtrace_python_sdk/instrumentation/embedchain/patch.py,sha256=ovvBrtqUDwGSmSgK_S3pOOrDa4gkPSFG-HvmsxqmJE8,3627
|
@@ -312,8 +312,8 @@ tests/pinecone/cassettes/test_query.yaml,sha256=b5v9G3ssUy00oG63PlFUR3JErF2Js-5A
|
|
312
312
|
tests/pinecone/cassettes/test_upsert.yaml,sha256=neWmQ1v3d03V8WoLl8FoFeeCYImb8pxlJBWnFd_lITU,38607
|
313
313
|
tests/qdrant/conftest.py,sha256=9n0uHxxIjWk9fbYc4bx-uP8lSAgLBVx-cV9UjnsyCHM,381
|
314
314
|
tests/qdrant/test_qdrant.py,sha256=pzjAjVY2kmsmGfrI2Gs2xrolfuaNHz7l1fqGQCjp5_o,3353
|
315
|
-
langtrace_python_sdk-3.8.
|
316
|
-
langtrace_python_sdk-3.8.
|
317
|
-
langtrace_python_sdk-3.8.
|
318
|
-
langtrace_python_sdk-3.8.
|
319
|
-
langtrace_python_sdk-3.8.
|
315
|
+
langtrace_python_sdk-3.8.15.dist-info/METADATA,sha256=bwp9ceCkaDntiZrMjbZb4IPkzgJVPMS-dqibINbH-KA,15845
|
316
|
+
langtrace_python_sdk-3.8.15.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
317
|
+
langtrace_python_sdk-3.8.15.dist-info/entry_points.txt,sha256=1_b9-qvf2fE7uQNZcbUei9vLpFZBbbh9LrtGw95ssAo,70
|
318
|
+
langtrace_python_sdk-3.8.15.dist-info/licenses/LICENSE,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
|
319
|
+
langtrace_python_sdk-3.8.15.dist-info/RECORD,,
|
File without changes
|
{langtrace_python_sdk-3.8.13.dist-info → langtrace_python_sdk-3.8.15.dist-info}/entry_points.txt
RENAMED
File without changes
|
{langtrace_python_sdk-3.8.13.dist-info → langtrace_python_sdk-3.8.15.dist-info}/licenses/LICENSE
RENAMED
File without changes
|