olca 0.2.37__py3-none-any.whl → 0.2.39__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- olca/olcacli.py +15 -0
- olca/tracing.py +5 -2
- olca/utils.py +24 -0
- {olca-0.2.37.dist-info → olca-0.2.39.dist-info}/METADATA +1 -1
- olca-0.2.39.dist-info/RECORD +12 -0
- olca-0.2.37.dist-info/RECORD +0 -11
- {olca-0.2.37.dist-info → olca-0.2.39.dist-info}/LICENSE +0 -0
- {olca-0.2.37.dist-info → olca-0.2.39.dist-info}/WHEEL +0 -0
- {olca-0.2.37.dist-info → olca-0.2.39.dist-info}/entry_points.txt +0 -0
- {olca-0.2.37.dist-info → olca-0.2.39.dist-info}/top_level.txt +0 -0
olca/olcacli.py
CHANGED
@@ -5,6 +5,7 @@ import dotenv
|
|
5
5
|
from langchain import hub
|
6
6
|
import argparse
|
7
7
|
import yaml
|
8
|
+
from olca.utils import load_environment, initialize_langfuse
|
8
9
|
|
9
10
|
#jgwill/olca1
|
10
11
|
#olca1_prompt = hub.pull("jgwill/olca1") #Future use
|
@@ -180,6 +181,12 @@ def main():
|
|
180
181
|
args = _parse_args()
|
181
182
|
olca_config_file = 'olca.yml'
|
182
183
|
|
184
|
+
# Load environment variables first
|
185
|
+
load_environment()
|
186
|
+
|
187
|
+
# Initialize Langfuse if needed
|
188
|
+
langfuse = initialize_langfuse()
|
189
|
+
|
183
190
|
if args.init:
|
184
191
|
if os.path.exists(olca_config_file):
|
185
192
|
print("Error: Configuration file already exists. Cannot run 'olca init'.")
|
@@ -205,6 +212,14 @@ def main():
|
|
205
212
|
if tracing_enabled and not callbacks:
|
206
213
|
print("Warning: Tracing enabled but no handlers configured")
|
207
214
|
|
215
|
+
if tracing_enabled:
|
216
|
+
# Verify Langfuse configuration
|
217
|
+
if not all([os.getenv(key) for key in ["LANGFUSE_PUBLIC_KEY", "LANGFUSE_SECRET_KEY", "LANGFUSE_HOST"]]):
|
218
|
+
print("Warning: Langfuse environment variables missing")
|
219
|
+
# Verify LangSmith configuration
|
220
|
+
if not os.getenv("LANGCHAIN_API_KEY"):
|
221
|
+
print("Warning: LANGCHAIN_API_KEY not set")
|
222
|
+
|
208
223
|
try:
|
209
224
|
|
210
225
|
api_key_variable = "OPENAI_API_KEY"
|
olca/tracing.py
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
import os
|
2
2
|
from langfuse.callback import CallbackHandler as LangfuseCallbackHandler
|
3
|
+
from langfuse import Langfuse
|
4
|
+
from olca.utils import initialize_langfuse
|
3
5
|
|
4
6
|
class TracingManager:
|
5
7
|
def __init__(self, config):
|
@@ -28,8 +30,9 @@ class TracingManager:
|
|
28
30
|
os.environ["LANGCHAIN_TRACING_V2"] = "true"
|
29
31
|
|
30
32
|
def _setup_langfuse(self):
|
31
|
-
|
32
|
-
|
33
|
+
langfuse = initialize_langfuse()
|
34
|
+
if not langfuse:
|
35
|
+
print("Warning: Missing Langfuse environment variables")
|
33
36
|
return None
|
34
37
|
|
35
38
|
return LangfuseCallbackHandler()
|
olca/utils.py
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
import os
|
2
|
+
import sys
|
3
|
+
import dotenv
|
4
|
+
import webbrowser
|
5
|
+
from langfuse import Langfuse
|
6
|
+
|
7
|
+
def load_environment():
|
8
|
+
dotenv.load_dotenv(dotenv_path=os.path.join(os.getcwd(), ".env"))
|
9
|
+
|
10
|
+
# Try loading from home directory if variables are still not set
|
11
|
+
if not all([os.getenv(key) for key in ["LANGFUSE_PUBLIC_KEY", "LANGFUSE_SECRET_KEY", "LANGFUSE_HOST",
|
12
|
+
"LANGCHAIN_API_KEY", "OPENAI_API_KEY"]]):
|
13
|
+
dotenv.load_dotenv(dotenv_path=os.path.expanduser("~/.env"))
|
14
|
+
|
15
|
+
def initialize_langfuse():
|
16
|
+
required_vars = ["LANGFUSE_PUBLIC_KEY", "LANGFUSE_SECRET_KEY", "LANGFUSE_HOST"]
|
17
|
+
if not all(os.getenv(var) for var in required_vars):
|
18
|
+
return None
|
19
|
+
|
20
|
+
return Langfuse(
|
21
|
+
public_key=os.getenv("LANGFUSE_PUBLIC_KEY"),
|
22
|
+
secret_key=os.getenv("LANGFUSE_SECRET_KEY"),
|
23
|
+
host=os.getenv("LANGFUSE_HOST")
|
24
|
+
)
|
@@ -0,0 +1,12 @@
|
|
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=bcWbBS3LiojIS5Bgwj1WIrpK7fUjRfXuGxSw6YAJwFY,15431
|
5
|
+
olca/tracing.py,sha256=FnToJVhD7XxP0lBe_Ca7bQJYDHEs9bSaFqZx7rpbSaU,1269
|
6
|
+
olca/utils.py,sha256=l01DkaDw5ENl8tzN8X4Ftgntz321AEAY1gpRX8_5q6Q,879
|
7
|
+
olca-0.2.39.dist-info/LICENSE,sha256=gXf5dRMhNSbfLPYYTY_5hsZ1r7UU1OaKQEAQUhuIBkM,18092
|
8
|
+
olca-0.2.39.dist-info/METADATA,sha256=TDw83KsB88ORfYOdcCZpR0_NkTCi_MDIwSkd2mV8ezA,25311
|
9
|
+
olca-0.2.39.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
|
10
|
+
olca-0.2.39.dist-info/entry_points.txt,sha256=AhP5FMv6vnOq9C76V_vxRVIO50smnZXG4RIY47oD2_U,103
|
11
|
+
olca-0.2.39.dist-info/top_level.txt,sha256=bGDtAReS-xlS0F6MM-DyD0IQUqjNdWmgemnM3vNtrpI,5
|
12
|
+
olca-0.2.39.dist-info/RECORD,,
|
olca-0.2.37.dist-info/RECORD
DELETED
@@ -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=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,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|