Skip to content

Commit 907eba4

Browse files
karthikscale3alizenhomobinnascale3obinnaokafor
authored
Release (#530)
* remove logs * remove requirements * Bump version * Squash * minor * switch to http exporter * bump version * bump version * add project details * cleanup * Obinna/s3 en 1111 fix dspy error (#528) * update dspy instrumentation and examples * bump version --------- Co-authored-by: Obinna Okafor <obinna.okafor01@gmail.com> * Improve Cleanlab Instrumentation (#529) * cleanlab fix * bump version --------- Co-authored-by: Ali Waleed <ali@scale3labs.com> Co-authored-by: obinnascale3 <109410793+obinnascale3@users.noreply.github.com> Co-authored-by: Obinna Okafor <obinna.okafor01@gmail.com>
1 parent 00370f5 commit 907eba4

File tree

12 files changed

+22
-23
lines changed

12 files changed

+22
-23
lines changed

src/examples/dspy_example/QA_basic.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88

99
# configure the language model to be used by dspy
1010

11-
llm = dspy.Claude()
12-
dspy.settings.configure(lm=llm)
11+
lm = dspy.LM('claude-3-opus-20240229')
12+
dspy.configure(lm=lm)
1313

1414
# create a prompt format that says that the llm will take a question and give back an answer
1515
predict = dspy.Predict("question -> answer")

src/examples/dspy_example/QA_basic_with_chain_of_thought.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
langtrace.init(disable_instrumentations={"all_except": ["dspy", "anthropic"]})
88

99
# configure the language model to be used by dspy
10-
llm = dspy.Claude()
11-
dspy.settings.configure(lm=llm)
10+
lm = dspy.LM('claude-3-opus-20240229')
11+
dspy.configure(lm=lm)
1212

1313

1414
# create a signature for basic question answering

src/examples/dspy_example/QA_basic_with_signature.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
langtrace.init(disable_instrumentations={"all_except": ["dspy", "anthropic"]})
88

99
# configure the language model to be used by dspy
10-
llm = dspy.Claude()
11-
dspy.settings.configure(lm=llm)
10+
lm = dspy.LM('claude-3-opus-20240229')
11+
dspy.configure(lm=lm)
1212

1313

1414
# create a signature for basic question answering

src/examples/dspy_example/QA_multi_step_with_chain_of_thought.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
langtrace.init(disable_instrumentations={"all_except": ["dspy", "anthropic"]})
88

99
# configure the language model to be used by dspy
10-
llm = dspy.Claude()
11-
dspy.settings.configure(lm=llm)
10+
lm = dspy.LM('claude-3-opus-20240229')
11+
dspy.configure(lm=lm)
1212

1313

1414
# create a signature for basic question answering

src/examples/dspy_example/math_problems_cot.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77

88
langtrace.init()
99

10-
turbo = dspy.OpenAI(model="gpt-3.5-turbo", max_tokens=250)
11-
dspy.settings.configure(lm=turbo)
10+
lm = dspy.LM('gpt-3.5-turbo')
11+
dspy.configure(lm=lm)
1212

1313
# Load math questions from the GSM8K dataset
1414
gsm8k = GSM8K()

src/examples/dspy_example/math_problems_cot_parallel.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99

1010
langtrace.init()
1111

12-
turbo = dspy.OpenAI(model="gpt-3.5-turbo", max_tokens=250)
13-
dspy.settings.configure(lm=turbo)
12+
lm = dspy.LM('gpt-3.5-turbo')
13+
dspy.configure(lm=lm)
1414

1515
# Load math questions from the GSM8K dataset
1616
gsm8k = GSM8K()

src/examples/dspy_example/program_of_thought_basic.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55

66
langtrace.init()
77

8-
turbo = dspy.OpenAI(model="gpt-3.5-turbo", max_tokens=250)
9-
dspy.settings.configure(lm=turbo)
8+
lm = dspy.LM('gpt-3.5-turbo')
9+
dspy.configure(lm=lm)
1010

1111

1212
# Define a simple signature for basic question answering

src/examples/dspy_example/react.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515

1616
langtrace.init()
1717

18-
turbo = dspy.OpenAI(model="gpt-3.5-turbo", max_tokens=250)
19-
dspy.settings.configure(lm=turbo)
18+
lm = dspy.LM('gpt-3.5-turbo')
19+
dspy.configure(lm=lm)
2020

2121
colbertv2_wiki17_abstracts = dspy.ColBERTv2(
2222
url="http://20.102.90.50:2017/wiki17_abstracts"

src/langtrace_python_sdk/instrumentation/cleanlab/patch.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ def traced_method(
6363
result_json = str(result)
6464

6565
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", "")))
6670
span.set_status(Status(StatusCode.OK))
6771

6872
return result

src/langtrace_python_sdk/instrumentation/dspy/instrumentation.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,6 @@ def _instrument(self, **kwargs):
7070
"MultiChainComparison.forward",
7171
patch_signature("MultiChainComparison.forward", version, tracer),
7272
)
73-
_W(
74-
"dspy.predict.retry",
75-
"Retry.forward",
76-
patch_signature("Retry.forward", version, tracer),
77-
)
7873
_W(
7974
"dspy.evaluate.evaluate",
8075
"Evaluate.__call__",

0 commit comments

Comments
 (0)