olca 0.2.65__tar.gz → 0.2.71__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {olca-0.2.65 → olca-0.2.71}/PKG-INFO +1 -1
- {olca-0.2.65 → olca-0.2.71}/olca/oiv.py +2 -2
- {olca-0.2.65 → olca-0.2.71}/olca/olcacli.py +18 -5
- {olca-0.2.65 → olca-0.2.71}/olca/olcahelper.py +8 -2
- {olca-0.2.65 → olca-0.2.71}/olca/tracing.py +2 -2
- {olca-0.2.65 → olca-0.2.71}/olca/utils.py +1 -1
- {olca-0.2.65 → olca-0.2.71}/olca.egg-info/PKG-INFO +1 -1
- {olca-0.2.65 → olca-0.2.71}/pyproject.toml +1 -1
- {olca-0.2.65 → olca-0.2.71}/setup.py +1 -1
- {olca-0.2.65 → olca-0.2.71}/LICENSE +0 -0
- {olca-0.2.65 → olca-0.2.71}/README.md +0 -0
- {olca-0.2.65 → olca-0.2.71}/olca/__init__.py +0 -0
- {olca-0.2.65 → olca-0.2.71}/olca/fusewill_cli.py +0 -0
- {olca-0.2.65 → olca-0.2.71}/olca/fusewill_utils.py +0 -0
- {olca-0.2.65 → olca-0.2.71}/olca/prompts.py +0 -0
- {olca-0.2.65 → olca-0.2.71}/olca.egg-info/SOURCES.txt +0 -0
- {olca-0.2.65 → olca-0.2.71}/olca.egg-info/dependency_links.txt +0 -0
- {olca-0.2.65 → olca-0.2.71}/olca.egg-info/entry_points.txt +0 -0
- {olca-0.2.65 → olca-0.2.71}/olca.egg-info/requires.txt +0 -0
- {olca-0.2.65 → olca-0.2.71}/olca.egg-info/top_level.txt +0 -0
- {olca-0.2.65 → olca-0.2.71}/setup.cfg +0 -0
@@ -76,7 +76,7 @@ def serialize_response_to_json_file(resp, filename):
|
|
76
76
|
f.write(json_str)
|
77
77
|
|
78
78
|
def serialize_response_to_markdown(o):
|
79
|
-
output=o["output"]
|
79
|
+
output=o["output"]
|
80
80
|
string_md="# Output\n"
|
81
81
|
#string_md+=f"## Model\n{o['model']}\n"
|
82
82
|
#string_md+=f"## Prompt\n{o['prompt']['prompt']}\n"
|
@@ -99,7 +99,7 @@ def main():
|
|
99
99
|
resp = ask_agent(input_request,tool_hub_tag=tool_hub_tag,chatbot_model=args.chatbot_model)
|
100
100
|
outdir=os.path.join(os.getcwd(),"output")
|
101
101
|
os.makedirs(outdir, exist_ok=True)
|
102
|
-
out_filename = f"{args.prefix}
|
102
|
+
out_filename = f"{args.prefix}{tlid.get_minutes()}.json"
|
103
103
|
outfile=os.path.join(outdir,out_filename)
|
104
104
|
o={}
|
105
105
|
prompt_dict = {
|
@@ -161,9 +161,6 @@ def main():
|
|
161
161
|
# Load environment variables first
|
162
162
|
load_environment()
|
163
163
|
|
164
|
-
# Initialize Langfuse if needed
|
165
|
-
langfuse = initialize_langfuse(debug=True if args.debug else False)
|
166
|
-
|
167
164
|
if args.init:
|
168
165
|
if os.path.exists(olca_config_file):
|
169
166
|
print("Error: Configuration file already exists. Cannot run 'olca init'.")
|
@@ -179,6 +176,12 @@ def main():
|
|
179
176
|
return
|
180
177
|
|
181
178
|
config = load_config(olca_config_file)
|
179
|
+
|
180
|
+
tracing_providers = config.get('tracing_providers', [])
|
181
|
+
if 'langfuse' in tracing_providers:
|
182
|
+
langfuse = initialize_langfuse(debug=True if args.debug else False)
|
183
|
+
else:
|
184
|
+
langfuse = None
|
182
185
|
|
183
186
|
# Initialize tracing
|
184
187
|
tracing_manager = TracingManager(config)
|
@@ -225,8 +228,18 @@ def main():
|
|
225
228
|
provider, base_model, host = parse_model_uri(model_name)
|
226
229
|
|
227
230
|
if provider == "ollama":
|
228
|
-
|
229
|
-
|
231
|
+
import ollama
|
232
|
+
from langchain_ollama import ChatOllama
|
233
|
+
try:
|
234
|
+
ollama.Client(host=host if host else None).show(base_model)
|
235
|
+
except:
|
236
|
+
print(f"Model {base_model} not found, pulling it...")
|
237
|
+
pull_stream = ollama.Client(host=host if host else None).pull(base_model, stream=True)
|
238
|
+
for chunk in pull_stream:
|
239
|
+
pass
|
240
|
+
print(f"\nPulled {base_model}")
|
241
|
+
|
242
|
+
model = ChatOllama(model=base_model, host=host if host else None)
|
230
243
|
|
231
244
|
elif provider == "openai":
|
232
245
|
from langchain_openai import ChatOpenAI
|
@@ -43,9 +43,15 @@ def initialize_config_file():
|
|
43
43
|
"temperature": float(input("temperature [0]: ") or default_temperature),
|
44
44
|
"human": input("human [true]: ").lower() in ["true", "yes", "y", "1", ""] or use_default_human_input,
|
45
45
|
"tracing": input("tracing [true]: ").lower() in ["true", "yes", "y", "1", ""] or use_default_tracing,
|
46
|
-
"tracing_providers": ["langsmith", "langfuse"]
|
47
46
|
}
|
48
|
-
|
47
|
+
|
48
|
+
tracing_providers = []
|
49
|
+
if input("Use langsmith for tracing? [Y/n]: ").lower() in ["y", "yes", ""]:
|
50
|
+
tracing_providers.append("langsmith")
|
51
|
+
if input("Use langfuse for tracing? [Y/n]: ").lower() in ["y", "yes", ""]:
|
52
|
+
tracing_providers.append("langfuse")
|
53
|
+
config["tracing_providers"] = tracing_providers
|
54
|
+
|
49
55
|
user_system_instructions = input(f"system_instructions [{default_system_instructions}]: ")
|
50
56
|
user_system_instructions = user_system_instructions or default_system_instructions
|
51
57
|
user_system_instructions = user_system_instructions.replace("\n", " ").replace("\r", " ").replace("\t", " ")
|
@@ -1,6 +1,4 @@
|
|
1
1
|
import os
|
2
|
-
from langfuse.callback import CallbackHandler as LangfuseCallbackHandler
|
3
|
-
from langfuse import Langfuse
|
4
2
|
from olca.utils import initialize_langfuse
|
5
3
|
import warnings
|
6
4
|
|
@@ -35,6 +33,8 @@ class TracingManager:
|
|
35
33
|
os.environ["LANGCHAIN_TRACING_V2"] = "true"
|
36
34
|
|
37
35
|
def _setup_langfuse(self):
|
36
|
+
from langfuse.callback import CallbackHandler as LangfuseCallbackHandler
|
37
|
+
from langfuse import Langfuse
|
38
38
|
self.langfuse = initialize_langfuse()
|
39
39
|
if not self.langfuse:
|
40
40
|
print("Warning: Missing Langfuse environment variables")
|
@@ -2,7 +2,6 @@ import os
|
|
2
2
|
import sys
|
3
3
|
import dotenv
|
4
4
|
import webbrowser
|
5
|
-
from langfuse import Langfuse
|
6
5
|
|
7
6
|
def load_environment():
|
8
7
|
dotenv.load_dotenv(dotenv_path=os.path.join(os.getcwd(), ".env"))
|
@@ -13,6 +12,7 @@ def load_environment():
|
|
13
12
|
dotenv.load_dotenv(dotenv_path=os.path.expanduser("~/.env"))
|
14
13
|
|
15
14
|
def initialize_langfuse( debug=False):
|
15
|
+
from langfuse import Langfuse
|
16
16
|
required_vars = ["LANGFUSE_PUBLIC_KEY", "LANGFUSE_SECRET_KEY", "LANGFUSE_HOST"]
|
17
17
|
if not all(os.getenv(var) for var in required_vars):
|
18
18
|
return None
|
@@ -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.71",
|
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
|
File without changes
|