olca 0.2.35__py3-none-any.whl → 0.2.37__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.
olca/olcacli.py CHANGED
@@ -135,11 +135,19 @@ def extract_extra_directories_from_olca_config_system_and_user_input(system_inst
135
135
 
136
136
  def print_stream(stream):
137
137
  for s in stream:
138
- message = s["messages"][-1]
139
- if isinstance(message, tuple):
140
- print(message)
141
- else:
142
- message.pretty_print()
138
+ try:
139
+ # Handle different response formats
140
+ if isinstance(s, dict) and "messages" in s:
141
+ message = s["messages"][-1]
142
+ else:
143
+ message = s
144
+
145
+ if isinstance(message, tuple):
146
+ print(message)
147
+ else:
148
+ print(message.content)
149
+ except Exception as e:
150
+ print(s)
143
151
 
144
152
  def prepare_input(user_input, system_instructions,append_prompt=True, human=False):
145
153
  appended_prompt = system_instructions + SYSTEM_PROMPT_APPEND if append_prompt else system_instructions
@@ -192,21 +200,10 @@ def main():
192
200
  tracing_manager = TracingManager(config)
193
201
  callbacks = tracing_manager.get_callbacks()
194
202
 
195
- # Check for tracing flag in config and CLI
196
- tracing_enabled = config.get('tracing', False) or args.tracing or os.getenv("LANGCHAIN_TRACING_V2") == "true"
197
- if tracing_enabled:
198
- os.environ["LANGCHAIN_TRACING_V2"] = "true"
199
- if not os.getenv("LANGCHAIN_API_KEY"):
200
- print("Error: LANGCHAIN_API_KEY environment variable is required for tracing. Please set it up at : https://smith.langchain.com/settings")
201
- exit(1)
202
- # Initialize LangSmith client
203
- import langsmith
204
- LANGSMITH_API_KEY = os.getenv("LANGSMITH_API_KEY")
205
- LANGCHAIN_API_KEY = os.getenv("LANGCHAIN_API_KEY")
206
- if not LANGSMITH_API_KEY and not LANGCHAIN_API_KEY:
207
- print("Error: LANGSMITH_API_KEY or LANGCHAIN_API_KEY environment variable is not set.")
208
- exit(1)
209
- client = langsmith.Client(api_key=LANGSMITH_API_KEY or LANGCHAIN_API_KEY)
203
+ # Remove old tracing setup
204
+ tracing_enabled = config.get('tracing', False) or args.tracing
205
+ if tracing_enabled and not callbacks:
206
+ print("Warning: Tracing enabled but no handlers configured")
210
207
 
211
208
  try:
212
209
 
@@ -292,7 +289,10 @@ def main():
292
289
 
293
290
 
294
291
  try:
295
- print_stream(graph.stream(inputs, config={"callbacks": callbacks} if callbacks else None))
292
+ graph_config = {"callbacks": callbacks} if callbacks else {}
293
+ if recursion_limit:
294
+ graph_config["recursion_limit"] = recursion_limit
295
+ print_stream(graph.stream(inputs, config=graph_config))
296
296
  except GraphRecursionError as e:
297
297
  #print(f"Error: {e}")
298
298
  print("Recursion limit reached. Please increase the 'recursion_limit' in the olca_config.yaml file.")
olca/tracing.py CHANGED
@@ -1,6 +1,5 @@
1
1
  import os
2
2
  from langfuse.callback import CallbackHandler as LangfuseCallbackHandler
3
- import langsmith
4
3
 
5
4
  class TracingManager:
6
5
  def __init__(self, config):
@@ -16,9 +15,7 @@ class TracingManager:
16
15
  return
17
16
 
18
17
  if 'langsmith' in providers:
19
- handler = self._setup_langsmith()
20
- if handler:
21
- self.handlers.append(handler)
18
+ self._setup_langsmith()
22
19
 
23
20
  if 'langfuse' in providers:
24
21
  handler = self._setup_langfuse()
@@ -26,14 +23,9 @@ class TracingManager:
26
23
  self.handlers.append(handler)
27
24
 
28
25
  def _setup_langsmith(self):
29
- os.environ["LANGCHAIN_TRACING_V2"] = "true"
30
26
  api_key = os.getenv("LANGCHAIN_API_KEY") or os.getenv("LANGSMITH_API_KEY")
31
-
32
- if not api_key:
33
- print("Warning: LANGCHAIN_API_KEY/LANGSMITH_API_KEY not set for LangSmith tracing")
34
- return None
35
-
36
- return langsmith.Client(api_key=api_key)
27
+ if api_key:
28
+ os.environ["LANGCHAIN_TRACING_V2"] = "true"
37
29
 
38
30
  def _setup_langfuse(self):
39
31
  if not (os.getenv("LANGFUSE_PUBLIC_KEY") and os.getenv("LANGFUSE_SECRET_KEY")):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: olca
3
- Version: 0.2.35
3
+ Version: 0.2.37
4
4
  Summary: A Python package for experimental usage of Langchain and Human-in-the-Loop
5
5
  Home-page: https://github.com/jgwill/olca
6
6
  Author: Jean GUillaume ISabelle
@@ -0,0 +1,11 @@
1
+ olca/__init__.py,sha256=3QyLLAys_KiiDIe-cfO_7QyY7di_qCaCS-sVziW2BOw,23
2
+ olca/fusewill_cli.py,sha256=Gf8CaYs7Uo4NH8QfgRNYalpmSUo047p9rzdkvIABHi8,7872
3
+ olca/fusewill_utils.py,sha256=IOIElqWCIsNzePlS1FZa5_35vySYLwbMUGW6UhNefIc,6065
4
+ olca/olcacli.py,sha256=yUHnASmkXn2FygwA-MhTzgaJOhD4yEvuqIp7ghote3o,14834
5
+ olca/tracing.py,sha256=A6K9K_mhCPS1_NncFv2-7hbeMkqfKT3XgUCERusbIYE,1248
6
+ olca-0.2.37.dist-info/LICENSE,sha256=gXf5dRMhNSbfLPYYTY_5hsZ1r7UU1OaKQEAQUhuIBkM,18092
7
+ olca-0.2.37.dist-info/METADATA,sha256=oQql8pKoyL4SKiOlvHlUnmjEKYQwbF0P76iGH328i3M,25311
8
+ olca-0.2.37.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
9
+ olca-0.2.37.dist-info/entry_points.txt,sha256=AhP5FMv6vnOq9C76V_vxRVIO50smnZXG4RIY47oD2_U,103
10
+ olca-0.2.37.dist-info/top_level.txt,sha256=bGDtAReS-xlS0F6MM-DyD0IQUqjNdWmgemnM3vNtrpI,5
11
+ olca-0.2.37.dist-info/RECORD,,
@@ -1,11 +0,0 @@
1
- olca/__init__.py,sha256=3QyLLAys_KiiDIe-cfO_7QyY7di_qCaCS-sVziW2BOw,23
2
- olca/fusewill_cli.py,sha256=Gf8CaYs7Uo4NH8QfgRNYalpmSUo047p9rzdkvIABHi8,7872
3
- olca/fusewill_utils.py,sha256=IOIElqWCIsNzePlS1FZa5_35vySYLwbMUGW6UhNefIc,6065
4
- olca/olcacli.py,sha256=0t8HBP-tLwgRCOi9z0gLgA_2UD5YB--_V8izDWPMJbQ,15143
5
- olca/tracing.py,sha256=D8RL6QnBdjCyjxyt-3LHTbq4NVL_6gXYjjw20ewQX2I,1536
6
- olca-0.2.35.dist-info/LICENSE,sha256=gXf5dRMhNSbfLPYYTY_5hsZ1r7UU1OaKQEAQUhuIBkM,18092
7
- olca-0.2.35.dist-info/METADATA,sha256=Wr-OlwhfER3iUCvqsDrWyb4lrugjhlueCg46jcYrK1o,25311
8
- olca-0.2.35.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
9
- olca-0.2.35.dist-info/entry_points.txt,sha256=AhP5FMv6vnOq9C76V_vxRVIO50smnZXG4RIY47oD2_U,103
10
- olca-0.2.35.dist-info/top_level.txt,sha256=bGDtAReS-xlS0F6MM-DyD0IQUqjNdWmgemnM3vNtrpI,5
11
- olca-0.2.35.dist-info/RECORD,,
File without changes
File without changes