olca 0.2.48__tar.gz → 0.2.49__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.48
3
+ Version: 0.2.49
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,6 +7,7 @@ import argparse
7
7
  import yaml
8
8
  from olca.utils import load_environment, initialize_langfuse
9
9
  from olca.tracing import TracingManager
10
+ from olca.olcahelper import setup_required_directories, initialize_config_file
10
11
 
11
12
  #jgwill/olca1
12
13
  #olca1_prompt = hub.pull("jgwill/olca1") #Future use
@@ -309,56 +310,8 @@ def main():
309
310
  print("For troubleshooting, visit: https://python.langchain.com/docs/troubleshooting/errors/GRAPH_RECURSION_LIMIT")
310
311
  except KeyboardInterrupt:
311
312
  print("\nExiting gracefully.")
312
- exit(0)
313
-
314
- def setup_required_directories(system_instructions, user_input):
315
- try:
316
- extra_directories=extract_extra_directories_from_olca_config_system_and_user_input(system_instructions, user_input)
317
- ensure_directories_exist(extra_directories)
318
- except:
319
- #We dont want to stop the program if it could not create the extra directories but we want to ensure common olca directories exist
320
- ensure_directories_exist()
321
-
322
- def initialize_config_file():
323
- try:
324
- default_system_instructions = "You are interacting using the human tool addressing carefully what the user is asking."
325
- default_user_input = "Interact with me to write a story using the 3 act structure that we will save in ./story/ - Make sure you interact with me and wont quit."
326
-
327
- default_model_name = "gpt-4o-mini"
328
- default_recursion_limit = 12
329
- default_temperature = 0
330
- use_default_human_input = True
331
- use_default_tracing = True
332
-
333
- config = {
334
- "api_keyname": input("api_keyname [OPENAI_API_KEY]: ") or "OPENAI_API_KEY",
335
- "model_name": input("model_name [gpt-4o-mini]: ") or default_model_name,
336
- "recursion_limit": int(input("recursion_limit [12]: ") or default_recursion_limit),
337
- "temperature": float(input("temperature [0]: ") or default_temperature),
338
- "human": input("human [true]: ").lower() in ["true", "yes", "y", "1", ""] or use_default_human_input,
339
- "tracing": input("tracing [true]: ").lower() in ["true", "yes", "y", "1", ""] or use_default_tracing,
340
- "tracing_providers": ["langsmith", "langfuse"]
341
- }
342
-
343
- user_system_instructions = input(f"system_instructions [{default_system_instructions}]: ")
344
- user_system_instructions = user_system_instructions or default_system_instructions
345
- user_system_instructions = user_system_instructions.replace("\n", " ").replace("\r", " ").replace("\t", " ")
346
-
347
- user_core_input = input(f"user_input [{default_user_input}]: ")
348
- user_core_input = user_core_input or default_user_input
349
- user_core_input = user_core_input.replace("\n", " ").replace("\r", " ").replace("\t", " ")
350
-
351
-
352
- config["system_instructions"] = user_system_instructions
353
- config["user_input"] = user_core_input
354
-
355
- with open('olca.yml', 'w') as file:
356
- yaml.dump(config, file)
357
- print("Configuration file 'olca.yml' created successfully.")
358
- inputs,system_instructions,user_input = prepare_input(config["user_input"], config["system_instructions"], True, config["human"])
359
- setup_required_directories(system_instructions, user_input)
360
- except KeyboardInterrupt:
361
- print("\nConfiguration canceled by user.")
313
+ tracing_manager.flush()
314
+ tracing_manager.shutdown()
362
315
  exit(0)
363
316
 
364
317
  if __name__ == "__main__":
@@ -0,0 +1,67 @@
1
+ import os
2
+ import yaml
3
+
4
+ def ensure_directories_exist(extra_directories=None):
5
+ directories = ['./reports', './log', './.olca']
6
+ if extra_directories:
7
+ directories += extra_directories
8
+ for directory in directories:
9
+ if not os.path.exists(directory):
10
+ os.makedirs(directory)
11
+
12
+ def extract_extra_directories_from_olca_config_system_and_user_input(system_instructions, user_input):
13
+ extra_directories = []
14
+ for input in [system_instructions, user_input]:
15
+ if input:
16
+ for word in input.split():
17
+ if word.startswith("./") and word.endswith("/"):
18
+ extra_directories.append(word)
19
+ return extra_directories
20
+
21
+ def setup_required_directories(system_instructions, user_input):
22
+ try:
23
+ extra_directories = extract_extra_directories_from_olca_config_system_and_user_input(system_instructions, user_input)
24
+ ensure_directories_exist(extra_directories)
25
+ except:
26
+ ensure_directories_exist()
27
+
28
+ def initialize_config_file():
29
+ try:
30
+ default_system_instructions = "You are interacting using the human tool addressing carefully what the user is asking."
31
+ default_user_input = "Interact with me to write a story using the 3 act structure that we will save in ./story/ - Make sure you interact with me and wont quit."
32
+
33
+ default_model_name = "gpt-4o-mini"
34
+ default_recursion_limit = 12
35
+ default_temperature = 0
36
+ use_default_human_input = True
37
+ use_default_tracing = True
38
+
39
+ config = {
40
+ "api_keyname": input("api_keyname [OPENAI_API_KEY]: ") or "OPENAI_API_KEY",
41
+ "model_name": input("model_name [gpt-4o-mini]: ") or default_model_name,
42
+ "recursion_limit": int(input("recursion_limit [12]: ") or default_recursion_limit),
43
+ "temperature": float(input("temperature [0]: ") or default_temperature),
44
+ "human": input("human [true]: ").lower() in ["true", "yes", "y", "1", ""] or use_default_human_input,
45
+ "tracing": input("tracing [true]: ").lower() in ["true", "yes", "y", "1", ""] or use_default_tracing,
46
+ "tracing_providers": ["langsmith", "langfuse"]
47
+ }
48
+
49
+ user_system_instructions = input(f"system_instructions [{default_system_instructions}]: ")
50
+ user_system_instructions = user_system_instructions or default_system_instructions
51
+ user_system_instructions = user_system_instructions.replace("\n", " ").replace("\r", " ").replace("\t", " ")
52
+
53
+ user_core_input = input(f"user_input [{default_user_input}]: ")
54
+ user_core_input = user_core_input or default_user_input
55
+ user_core_input = user_core_input.replace("\n", " ").replace("\r", " ").replace("\t", " ")
56
+
57
+ config["system_instructions"] = user_system_instructions
58
+ config["user_input"] = user_core_input
59
+
60
+ with open('olca.yml', 'w') as file:
61
+ yaml.dump(config, file)
62
+ print("Configuration file 'olca.yml' created successfully.")
63
+ inputs, system_instructions, user_input = prepare_input(config["user_input"], config["system_instructions"], True, config["human"])
64
+ setup_required_directories(system_instructions, user_input)
65
+ except KeyboardInterrupt:
66
+ print("\nConfiguration canceled by user.")
67
+ exit(0)
@@ -39,7 +39,7 @@ class TracingManager:
39
39
  print("Warning: Missing Langfuse environment variables")
40
40
  return None
41
41
 
42
- return LangfuseCallbackHandler(batch_size=1000) # Adjust batch size as needed
42
+ return LangfuseCallbackHandler()
43
43
 
44
44
  def get_callbacks(self):
45
45
  return self.handlers if self.handlers else None
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: olca
3
- Version: 0.2.48
3
+ Version: 0.2.49
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
@@ -6,6 +6,7 @@ olca/__init__.py
6
6
  olca/fusewill_cli.py
7
7
  olca/fusewill_utils.py
8
8
  olca/olcacli.py
9
+ olca/olcahelper.py
9
10
  olca/tracing.py
10
11
  olca/utils.py
11
12
  olca.egg-info/PKG-INFO
@@ -7,7 +7,7 @@ build-backend = "setuptools.build_meta"
7
7
 
8
8
  [project]
9
9
  name = "olca"
10
- version = "0.2.48"
10
+ version = "0.2.49"
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.48",
5
+ version = "0.2.49",
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