olca 0.2.48__py3-none-any.whl → 0.2.49__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 +3 -50
- olca/olcahelper.py +67 -0
- olca/tracing.py +1 -1
- {olca-0.2.48.dist-info → olca-0.2.49.dist-info}/METADATA +1 -1
- olca-0.2.49.dist-info/RECORD +13 -0
- olca-0.2.48.dist-info/RECORD +0 -12
- {olca-0.2.48.dist-info → olca-0.2.49.dist-info}/LICENSE +0 -0
- {olca-0.2.48.dist-info → olca-0.2.49.dist-info}/WHEEL +0 -0
- {olca-0.2.48.dist-info → olca-0.2.49.dist-info}/entry_points.txt +0 -0
- {olca-0.2.48.dist-info → olca-0.2.49.dist-info}/top_level.txt +0 -0
olca/olcacli.py
CHANGED
@@ -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
|
-
|
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__":
|
olca/olcahelper.py
ADDED
@@ -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)
|
olca/tracing.py
CHANGED
@@ -39,7 +39,7 @@ class TracingManager:
|
|
39
39
|
print("Warning: Missing Langfuse environment variables")
|
40
40
|
return None
|
41
41
|
|
42
|
-
return LangfuseCallbackHandler(
|
42
|
+
return LangfuseCallbackHandler()
|
43
43
|
|
44
44
|
def get_callbacks(self):
|
45
45
|
return self.handlers if self.handlers else None
|
@@ -0,0 +1,13 @@
|
|
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=KFPFDXfHZFV3loXsbwo2DAITwI8xWvI9-iJBMRgQykM,13243
|
5
|
+
olca/olcahelper.py,sha256=WdN6-K-N7-HnB9L_px6TsDKWiTXIusZM2I1d0GNQnFs,3322
|
6
|
+
olca/tracing.py,sha256=4FprOOpq0tzucV1ekBlPgGXmTNLwJIfs21-oyheKXzA,1412
|
7
|
+
olca/utils.py,sha256=zM94HDMDYF95Yd9ubeOK6vuepbQN4kDFh0rTvaVFagI,912
|
8
|
+
olca-0.2.49.dist-info/LICENSE,sha256=gXf5dRMhNSbfLPYYTY_5hsZ1r7UU1OaKQEAQUhuIBkM,18092
|
9
|
+
olca-0.2.49.dist-info/METADATA,sha256=vV0Rzi6cxizD7s2JGN2fjT4_iuHdoH-Fwko18zGy5ZA,25311
|
10
|
+
olca-0.2.49.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
|
11
|
+
olca-0.2.49.dist-info/entry_points.txt,sha256=AhP5FMv6vnOq9C76V_vxRVIO50smnZXG4RIY47oD2_U,103
|
12
|
+
olca-0.2.49.dist-info/top_level.txt,sha256=bGDtAReS-xlS0F6MM-DyD0IQUqjNdWmgemnM3vNtrpI,5
|
13
|
+
olca-0.2.49.dist-info/RECORD,,
|
olca-0.2.48.dist-info/RECORD
DELETED
@@ -1,12 +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=JdIF3Si07uonzbmaA1H9WEkNPjCs_NszC0u1uU_oWB4,15875
|
5
|
-
olca/tracing.py,sha256=QX4qctLDmabdiPW_MySp-BD39qHMOxlLDvVag2mJ4ek,1458
|
6
|
-
olca/utils.py,sha256=zM94HDMDYF95Yd9ubeOK6vuepbQN4kDFh0rTvaVFagI,912
|
7
|
-
olca-0.2.48.dist-info/LICENSE,sha256=gXf5dRMhNSbfLPYYTY_5hsZ1r7UU1OaKQEAQUhuIBkM,18092
|
8
|
-
olca-0.2.48.dist-info/METADATA,sha256=tgrqOmAb2c1x3DlEL2dp6lMCXH9jm76pLIGprbUnTPM,25311
|
9
|
-
olca-0.2.48.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
|
10
|
-
olca-0.2.48.dist-info/entry_points.txt,sha256=AhP5FMv6vnOq9C76V_vxRVIO50smnZXG4RIY47oD2_U,103
|
11
|
-
olca-0.2.48.dist-info/top_level.txt,sha256=bGDtAReS-xlS0F6MM-DyD0IQUqjNdWmgemnM3vNtrpI,5
|
12
|
-
olca-0.2.48.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|