olca 0.2.38__tar.gz → 0.2.39__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {olca-0.2.38 → olca-0.2.39}/PKG-INFO +1 -1
- {olca-0.2.38 → olca-0.2.39}/olca/olcacli.py +4 -10
- {olca-0.2.38 → olca-0.2.39}/olca/tracing.py +3 -7
- olca-0.2.39/olca/utils.py +24 -0
- {olca-0.2.38 → olca-0.2.39}/olca.egg-info/PKG-INFO +1 -1
- {olca-0.2.38 → olca-0.2.39}/olca.egg-info/SOURCES.txt +1 -0
- {olca-0.2.38 → olca-0.2.39}/pyproject.toml +1 -1
- {olca-0.2.38 → olca-0.2.39}/setup.py +1 -1
- {olca-0.2.38 → olca-0.2.39}/LICENSE +0 -0
- {olca-0.2.38 → olca-0.2.39}/README.md +0 -0
- {olca-0.2.38 → olca-0.2.39}/olca/__init__.py +0 -0
- {olca-0.2.38 → olca-0.2.39}/olca/fusewill_cli.py +0 -0
- {olca-0.2.38 → olca-0.2.39}/olca/fusewill_utils.py +0 -0
- {olca-0.2.38 → olca-0.2.39}/olca.egg-info/dependency_links.txt +0 -0
- {olca-0.2.38 → olca-0.2.39}/olca.egg-info/entry_points.txt +0 -0
- {olca-0.2.38 → olca-0.2.39}/olca.egg-info/requires.txt +0 -0
- {olca-0.2.38 → olca-0.2.39}/olca.egg-info/top_level.txt +0 -0
- {olca-0.2.38 → olca-0.2.39}/setup.cfg +0 -0
@@ -5,7 +5,7 @@ import dotenv
|
|
5
5
|
from langchain import hub
|
6
6
|
import argparse
|
7
7
|
import yaml
|
8
|
-
import
|
8
|
+
from olca.utils import load_environment, initialize_langfuse
|
9
9
|
|
10
10
|
#jgwill/olca1
|
11
11
|
#olca1_prompt = hub.pull("jgwill/olca1") #Future use
|
@@ -177,15 +177,6 @@ def _parse_args():
|
|
177
177
|
|
178
178
|
from olca.tracing import TracingManager
|
179
179
|
|
180
|
-
def load_environment():
|
181
|
-
# Load .env from current directory
|
182
|
-
dotenv.load_dotenv(dotenv_path=os.path.join(os.getcwd(), ".env"))
|
183
|
-
|
184
|
-
# Try loading from home directory if keys are missing
|
185
|
-
if not all([os.getenv(key) for key in ["LANGFUSE_PUBLIC_KEY", "LANGFUSE_SECRET_KEY", "LANGFUSE_HOST",
|
186
|
-
"LANGCHAIN_API_KEY", "OPENAI_API_KEY"]]):
|
187
|
-
dotenv.load_dotenv(dotenv_path=os.path.expanduser("~/.env"))
|
188
|
-
|
189
180
|
def main():
|
190
181
|
args = _parse_args()
|
191
182
|
olca_config_file = 'olca.yml'
|
@@ -193,6 +184,9 @@ def main():
|
|
193
184
|
# Load environment variables first
|
194
185
|
load_environment()
|
195
186
|
|
187
|
+
# Initialize Langfuse if needed
|
188
|
+
langfuse = initialize_langfuse()
|
189
|
+
|
196
190
|
if args.init:
|
197
191
|
if os.path.exists(olca_config_file):
|
198
192
|
print("Error: Configuration file already exists. Cannot run 'olca init'.")
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import os
|
2
2
|
from langfuse.callback import CallbackHandler as LangfuseCallbackHandler
|
3
3
|
from langfuse import Langfuse
|
4
|
+
from olca.utils import initialize_langfuse
|
4
5
|
|
5
6
|
class TracingManager:
|
6
7
|
def __init__(self, config):
|
@@ -29,16 +30,11 @@ class TracingManager:
|
|
29
30
|
os.environ["LANGCHAIN_TRACING_V2"] = "true"
|
30
31
|
|
31
32
|
def _setup_langfuse(self):
|
32
|
-
|
33
|
-
if not
|
33
|
+
langfuse = initialize_langfuse()
|
34
|
+
if not langfuse:
|
34
35
|
print("Warning: Missing Langfuse environment variables")
|
35
36
|
return None
|
36
37
|
|
37
|
-
Langfuse(
|
38
|
-
public_key=os.getenv("LANGFUSE_PUBLIC_KEY"),
|
39
|
-
secret_key=os.getenv("LANGFUSE_SECRET_KEY"),
|
40
|
-
host=os.getenv("LANGFUSE_HOST")
|
41
|
-
)
|
42
38
|
return LangfuseCallbackHandler()
|
43
39
|
|
44
40
|
def get_callbacks(self):
|
@@ -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
|
+
)
|
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
|
|
2
2
|
|
3
3
|
setup(
|
4
4
|
name='olca',
|
5
|
-
version = "0.2.
|
5
|
+
version = "0.2.39",
|
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
|