olca 0.2.66__py3-none-any.whl → 0.2.71__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
olca/olcacli.py CHANGED
@@ -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
- from langchain_ollama import OllamaLLM
229
- model = OllamaLLM(model=base_model, base_url=host if host else None)
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
olca/olcahelper.py CHANGED
@@ -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", " ")
olca/tracing.py CHANGED
@@ -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")
olca/utils.py CHANGED
@@ -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
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: olca
3
- Version: 0.2.66
3
+ Version: 0.2.71
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
@@ -0,0 +1,15 @@
1
+ olca/__init__.py,sha256=3QyLLAys_KiiDIe-cfO_7QyY7di_qCaCS-sVziW2BOw,23
2
+ olca/fusewill_cli.py,sha256=7etgdpM64-jXGLlALG7PtwICAzoLKYGMBRvHf5nMLic,17119
3
+ olca/fusewill_utils.py,sha256=sNCe4LhpSaEOY5olMxW1nTv7CKiT__dc2lGomelE6mY,18207
4
+ olca/oiv.py,sha256=TyhbgjzE9B5woacln8AtITLv1X7iv9ZivJBdk0MyP4U,4610
5
+ olca/olcacli.py,sha256=wwn4mL1kGonigI9w6UEsnFJDWQ6yONxqvogjrCj-Og4,11246
6
+ olca/olcahelper.py,sha256=v16ETPboJFdJdkL1iAJ86_oAhkFo5jMFfx5oivOG8kA,4115
7
+ olca/prompts.py,sha256=q7lvDZ8n_K6ea2nu3K5R2fgBgQYrCIEjh0cA9fUlMFI,3697
8
+ olca/tracing.py,sha256=cEfPNZoI-PbMHFpX8bvY7OajeW4yvZBMycqwj6sRpDE,1637
9
+ olca/utils.py,sha256=kDxKwD51234OvA6PIW9IfAND8DHwd8lSyOvSf4abvPE,916
10
+ olca-0.2.71.dist-info/LICENSE,sha256=gXf5dRMhNSbfLPYYTY_5hsZ1r7UU1OaKQEAQUhuIBkM,18092
11
+ olca-0.2.71.dist-info/METADATA,sha256=fbrb7yvxwGwURri-_bic01CVFQrcMRjrqWRRYh0GoG0,25808
12
+ olca-0.2.71.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
13
+ olca-0.2.71.dist-info/entry_points.txt,sha256=W2UkinpMZYsCLH54must9ahwbzCRl-rekcZ7rL5u3wA,123
14
+ olca-0.2.71.dist-info/top_level.txt,sha256=bGDtAReS-xlS0F6MM-DyD0IQUqjNdWmgemnM3vNtrpI,5
15
+ olca-0.2.71.dist-info/RECORD,,
@@ -1,15 +0,0 @@
1
- olca/__init__.py,sha256=3QyLLAys_KiiDIe-cfO_7QyY7di_qCaCS-sVziW2BOw,23
2
- olca/fusewill_cli.py,sha256=7etgdpM64-jXGLlALG7PtwICAzoLKYGMBRvHf5nMLic,17119
3
- olca/fusewill_utils.py,sha256=sNCe4LhpSaEOY5olMxW1nTv7CKiT__dc2lGomelE6mY,18207
4
- olca/oiv.py,sha256=TyhbgjzE9B5woacln8AtITLv1X7iv9ZivJBdk0MyP4U,4610
5
- olca/olcacli.py,sha256=oftilrp9v0QOV5tJeb6o8nwO54gjjlwWVfDU5JpoXJc,10758
6
- olca/olcahelper.py,sha256=s9KwEYAJCbnKSXIsj5HCL-OHxkSsmL08ZBgoluxmP1s,3828
7
- olca/prompts.py,sha256=q7lvDZ8n_K6ea2nu3K5R2fgBgQYrCIEjh0cA9fUlMFI,3697
8
- olca/tracing.py,sha256=GSuXIKmIMQ9V2gLkKcin142Z2QpyS6obsnj8Tf-1zHc,1621
9
- olca/utils.py,sha256=zM94HDMDYF95Yd9ubeOK6vuepbQN4kDFh0rTvaVFagI,912
10
- olca-0.2.66.dist-info/LICENSE,sha256=gXf5dRMhNSbfLPYYTY_5hsZ1r7UU1OaKQEAQUhuIBkM,18092
11
- olca-0.2.66.dist-info/METADATA,sha256=rnjt54tCa8STAp7ZbD8VKHsW5AJtAh2NGQ9Dyjym2mQ,25808
12
- olca-0.2.66.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
13
- olca-0.2.66.dist-info/entry_points.txt,sha256=W2UkinpMZYsCLH54must9ahwbzCRl-rekcZ7rL5u3wA,123
14
- olca-0.2.66.dist-info/top_level.txt,sha256=bGDtAReS-xlS0F6MM-DyD0IQUqjNdWmgemnM3vNtrpI,5
15
- olca-0.2.66.dist-info/RECORD,,
File without changes
File without changes