olca 0.2.46__tar.gz → 0.2.47__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: olca
3
- Version: 0.2.46
3
+ Version: 0.2.47
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
@@ -234,7 +234,7 @@ def main():
234
234
  api_key = os.getenv(api_keyname)
235
235
  if api_key:
236
236
  os.environ[api_key_variable] = api_key
237
- except :
237
+ except:
238
238
  #load .env file in current dir or HOME and find OPENAI_API_KEY
239
239
  try:
240
240
  dotenv.load_dotenv()
@@ -246,17 +246,11 @@ def main():
246
246
  print("Error: Could not load .env file")
247
247
  exit(1)
248
248
 
249
-
250
-
251
-
252
-
253
-
254
-
255
249
  system_instructions = config.get('system_instructions', '')
256
250
  user_input = config.get('user_input', '')
257
251
  default_model_id = "gpt-4o-mini"
258
- model_name=config.get('model_name', default_model_id)
259
- recursion_limit=config.get('recursion_limit', 15)
252
+ model_name = config.get('model_name', default_model_id)
253
+ recursion_limit = config.get('recursion_limit', 15)
260
254
  disable_system_append = _parse_args().disable_system_append
261
255
 
262
256
  # Use the system_instructions and user_input in your CLI logic
@@ -266,11 +260,8 @@ def main():
266
260
  print("Recursion Limit:", recursion_limit)
267
261
  print("Trace:", tracing_enabled)
268
262
 
269
-
270
-
271
-
272
263
  model = ChatOpenAI(model=model_name, temperature=0)
273
- selected_tools = [ "terminal"]
264
+ selected_tools = ["terminal"]
274
265
 
275
266
  human_switch = args.human
276
267
  #look in olca_config.yaml for human: true
@@ -281,43 +272,44 @@ def main():
281
272
  selected_tools.append("human")
282
273
 
283
274
  if args.math:
284
- math_llm=OpenAI()
275
+ math_llm = OpenAI()
285
276
  selected_tools.append("llm-math")
286
277
  if human_switch:
287
- tools = load_tools( selected_tools, llm=math_llm, allow_dangerous_tools=True, input_func=get_input)
278
+ tools = load_tools(selected_tools, llm=math_llm, allow_dangerous_tools=True, input_func=get_input)
288
279
  else:
289
- tools = load_tools( selected_tools, llm=math_llm, allow_dangerous_tools=True)
280
+ tools = load_tools(selected_tools, llm=math_llm, allow_dangerous_tools=True)
290
281
  else:
291
282
  if human_switch:
292
- tools = load_tools( selected_tools, allow_dangerous_tools=True, input_func=get_input)
283
+ tools = load_tools(selected_tools, allow_dangerous_tools=True, input_func=get_input)
293
284
  else:
294
- tools = load_tools( selected_tools, allow_dangerous_tools=True)
285
+ tools = load_tools(selected_tools, allow_dangerous_tools=True)
295
286
 
296
287
  if human_switch:
297
288
  user_input = user_input + " Dont forget to USE THE HUMAN-IN-THE-LOOP TOOL"
298
- system_instructions= system_instructions + ". Use the human-in-the-loop tool"
289
+ system_instructions = system_instructions + ". Use the human-in-the-loop tool"
299
290
 
300
291
  # Define the graph
301
292
  graph = create_react_agent(model, tools=tools)
302
293
 
303
294
  if graph.config is None:
304
- graph.config = {}
295
+ graph.config = {}
305
296
  graph.config["recursion_limit"] = recursion_limit
306
297
 
307
- inputs,system_instructions,user_input = prepare_input(user_input, system_instructions, not disable_system_append, human_switch)
298
+ inputs, system_instructions, user_input = prepare_input(user_input, system_instructions, not disable_system_append, human_switch)
308
299
 
309
300
  setup_required_directories(system_instructions, user_input)
310
301
 
311
-
312
302
  try:
313
303
  graph_config = {"callbacks": callbacks} if callbacks else {}
314
304
  if recursion_limit:
315
305
  graph_config["recursion_limit"] = recursion_limit
316
306
  print_stream(graph.stream(inputs, config=graph_config))
317
307
  except GraphRecursionError as e:
318
- #print(f"Error: {e}")
319
308
  print("Recursion limit reached. Please increase the 'recursion_limit' in the olca_config.yaml file.")
320
309
  print("For troubleshooting, visit: https://python.langchain.com/docs/troubleshooting/errors/GRAPH_RECURSION_LIMIT")
310
+ except KeyboardInterrupt:
311
+ print("\nExiting gracefully.")
312
+ exit(0)
321
313
 
322
314
  def setup_required_directories(system_instructions, user_input):
323
315
  try:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: olca
3
- Version: 0.2.46
3
+ Version: 0.2.47
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
@@ -7,7 +7,7 @@ build-backend = "setuptools.build_meta"
7
7
 
8
8
  [project]
9
9
  name = "olca"
10
- version = "0.2.46"
10
+ version = "0.2.47"
11
11
 
12
12
  description = "A Python package for experimental usage of Langchain and Human-in-the-Loop"
13
13
  readme = "README.md"
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name='olca',
5
- version = "0.2.46",
5
+ version = "0.2.47",
6
6
  author='Jean GUillaume ISabelle',
7
7
  author_email='jgi@jgwill.com',
8
8
  description='A Python package for experimenting with Langchain agent and interactivity in Terminal modalities.',
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes