Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/examples/dspy_example/QA_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

# configure the language model to be used by dspy

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

# create a prompt format that says that the llm will take a question and give back an answer
predict = dspy.Predict("question -> answer")
Expand Down
4 changes: 2 additions & 2 deletions src/examples/dspy_example/QA_basic_with_chain_of_thought.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
langtrace.init(disable_instrumentations={"all_except": ["dspy", "anthropic"]})

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


# create a signature for basic question answering
Expand Down
4 changes: 2 additions & 2 deletions src/examples/dspy_example/QA_basic_with_signature.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
langtrace.init(disable_instrumentations={"all_except": ["dspy", "anthropic"]})

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


# create a signature for basic question answering
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
langtrace.init(disable_instrumentations={"all_except": ["dspy", "anthropic"]})

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


# create a signature for basic question answering
Expand Down
4 changes: 2 additions & 2 deletions src/examples/dspy_example/math_problems_cot.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

langtrace.init()

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

# Load math questions from the GSM8K dataset
gsm8k = GSM8K()
Expand Down
4 changes: 2 additions & 2 deletions src/examples/dspy_example/math_problems_cot_parallel.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

langtrace.init()

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

# Load math questions from the GSM8K dataset
gsm8k = GSM8K()
Expand Down
4 changes: 2 additions & 2 deletions src/examples/dspy_example/program_of_thought_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

langtrace.init()

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


# Define a simple signature for basic question answering
Expand Down
4 changes: 2 additions & 2 deletions src/examples/dspy_example/react.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@

langtrace.init()

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

colbertv2_wiki17_abstracts = dspy.ColBERTv2(
url="http://20.102.90.50:2017/wiki17_abstracts"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,6 @@ def _instrument(self, **kwargs):
"MultiChainComparison.forward",
patch_signature("MultiChainComparison.forward", version, tracer),
)
_W(
"dspy.predict.retry",
"Retry.forward",
patch_signature("Retry.forward", version, tracer),
)
_W(
"dspy.evaluate.evaluate",
"Evaluate.__call__",
Expand Down
2 changes: 1 addition & 1 deletion src/langtrace_python_sdk/instrumentation/dspy/patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def traced_method(wrapped, instance, args, kwargs):
prog = {
"name": args[0].prog.__class__.__name__,
"signature": (
str(args[0].prog.signature) if args[0].prog.signature else None
str(args[0].prog.signature) if hasattr(args[0].prog, "signature") else None
),
}
span_attributes["dspy.optimizer.module.prog"] = json.dumps(prog)
Expand Down
2 changes: 1 addition & 1 deletion src/langtrace_python_sdk/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "3.8.14"
__version__ = "3.8.15"