langtrace-python-sdk 2.1.23__py3-none-any.whl → 2.1.25__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.
@@ -3,25 +3,36 @@ import os
3
3
  import dspy
4
4
 
5
5
  # Add the local src folder to the Python path
6
- sys.path.insert(0, os.path.abspath('/Users/karthikkalyanaraman/work/langtrace/langtrace-python-sdk/src'))
6
+ sys.path.insert(
7
+ 0,
8
+ os.path.abspath(
9
+ "/Users/karthikkalyanaraman/work/langtrace/langtrace-python-sdk/src"
10
+ ),
11
+ )
7
12
 
8
13
  # flake8: noqa
9
14
  from langtrace_python_sdk import langtrace, with_langtrace_root_span
15
+
10
16
  langtrace.init()
11
17
 
12
- turbo = dspy.OpenAI(model='gpt-3.5-turbo', max_tokens=250)
18
+ turbo = dspy.OpenAI(model="gpt-3.5-turbo", max_tokens=250)
13
19
  dspy.settings.configure(lm=turbo)
14
20
 
15
- colbertv2_wiki17_abstracts = dspy.ColBERTv2(url='http://20.102.90.50:2017/wiki17_abstracts')
21
+ colbertv2_wiki17_abstracts = dspy.ColBERTv2(
22
+ url="http://20.102.90.50:2017/wiki17_abstracts"
23
+ )
16
24
  dspy.settings.configure(rm=colbertv2_wiki17_abstracts)
17
25
  retriever = dspy.Retrieve(k=3)
18
26
 
27
+
19
28
  # Define a simple signature for basic question answering
20
29
  class BasicQA(dspy.Signature):
21
30
  """Answer questions with short factoid answers."""
31
+
22
32
  question = dspy.InputField()
23
33
  answer = dspy.OutputField(desc="often between 1 and 5 words")
24
34
 
35
+
25
36
  @with_langtrace_root_span(name="react_example")
26
37
  def example():
27
38
 
@@ -29,11 +40,12 @@ def example():
29
40
  react_module = dspy.ReAct(BasicQA)
30
41
 
31
42
  # Call the ReAct module on a particular input
32
- question = 'Aside from the Apple Remote, what other devices can control the program Apple Remote was originally designed to interact with?'
43
+ question = "Aside from the Apple Remote, what other devices can control the program Apple Remote was originally designed to interact with?"
33
44
  result = react_module(question=question)
34
45
 
35
46
  print(f"Question: {question}")
36
47
  print(f"Final Predicted Answer (after ReAct process): {result.answer}")
37
48
 
38
- if __name__ == '__main__':
49
+
50
+ if __name__ == "__main__":
39
51
  example()