olca 0.2.54__py3-none-any.whl → 0.2.56__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/fusewill_cli.py CHANGED
@@ -92,6 +92,10 @@ def main():
92
92
  parser_list_by_score.add_argument('--max_value', type=float, help='Maximum score value')
93
93
  parser_list_by_score.add_argument('-L','--limit', type=int, default=100, help='Number of traces to fetch')
94
94
 
95
+ # list_scores command
96
+ parser_list_scores = subparsers.add_parser('list_scores', help='List all scores', aliases=['ls'])
97
+ parser_list_scores.add_argument('-o', '--output', type=str, help='Output JSON file path')
98
+
95
99
  args = parser.parse_args()
96
100
 
97
101
  if args.command == 'list_traces' or args.command == 'lt':
@@ -159,6 +163,20 @@ def main():
159
163
  for trace in traces:
160
164
  print_trace(trace)
161
165
  #print(f"Trace ID: {trace.id}, Name: {trace.name}")
166
+ elif args.command == 'list_scores' or args.command == 'ls':
167
+ scores = fu.list_scores()
168
+ if scores:
169
+ if args.output:
170
+ try:
171
+ with open(args.output, 'w') as f:
172
+ json.dump(scores, f, indent=2)
173
+ print(f"Scores written to {os.path.realpath(args.output)}")
174
+ except Exception as e:
175
+ print(f"Error writing to file {args.output}: {e}")
176
+ else:
177
+ print(json.dumps(scores, indent=2))
178
+ else:
179
+ print("No scores found.")
162
180
  else:
163
181
  parser.print_help()
164
182
  exit(1)
olca/fusewill_utils.py CHANGED
@@ -43,7 +43,11 @@ langfuse = Langfuse(
43
43
  secret_key=os.environ.get("LANGFUSE_SECRET_KEY"),
44
44
  host=os.environ.get("LANGFUSE_HOST")
45
45
  )
46
-
46
+ def dummy():
47
+ o=langfuse.get_observations()
48
+ g=langfuse.get_generations()
49
+ prompts_list=langfuse.get_dataset()
50
+
47
51
  def open_trace_in_browser(trace_id):
48
52
  base_url = os.environ.get("LANGFUSE_HOST")
49
53
  project_id = os.environ.get("LANGFUSE_PROJECT_ID")
@@ -68,6 +72,20 @@ def get_score_by_id(score_id):
68
72
  print(f"Error retrieving score {score_id}: {e}")
69
73
  return None
70
74
 
75
+ def list_scores():
76
+ """Retrieve all score configurations."""
77
+ base_url = os.environ.get("LANGFUSE_HOST")
78
+ public_key = os.environ.get("LANGFUSE_PUBLIC_KEY")
79
+ secret_key = os.environ.get("LANGFUSE_SECRET_KEY")
80
+ url = f"{base_url}/api/public/score-configs"
81
+ try:
82
+ response = requests.get(url, auth=(public_key, secret_key))
83
+ response.raise_for_status()
84
+ return response.json()
85
+ except Exception as e:
86
+ print(f"Error retrieving scores: {e}")
87
+ return None
88
+
71
89
  def print_trace(trace, show_comments=False):
72
90
  print(f"<Trace \n\tat=\"{trace.createdAt}\" \n\tid=\"{trace.id}\" \n\tname=\"{trace.name}\" \n\tsession_id=\"{trace.session_id}\" \n\tprojectId=\"{trace.projectId}\" >")
73
91
  print(f"<Input><CDATA[[\n{trace.input}\n]]></Input>")
@@ -157,7 +175,7 @@ def create_prompt(name, prompt_text, model_name, temperature, labels=None, suppo
157
175
  }
158
176
  )
159
177
  def get_prompt(name, label="production"):
160
- return langfuse.get_prompt(name=name,label="production")
178
+ return langfuse.get_prompt(name=name,label=label)
161
179
 
162
180
  def update_prompt(name, new_prompt_text):
163
181
  prompt = langfuse.get_prompt(name=name)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: olca
3
- Version: 0.2.54
3
+ Version: 0.2.56
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,13 @@
1
+ olca/__init__.py,sha256=3QyLLAys_KiiDIe-cfO_7QyY7di_qCaCS-sVziW2BOw,23
2
+ olca/fusewill_cli.py,sha256=_8e2j9DORxHlzCKCXzn-gKO6chWI7GTRhr35cvC7E3U,8682
3
+ olca/fusewill_utils.py,sha256=Ae0xgZzi12nenHEHTNFFObc4hWbuT5PsTjnsGFhDwX4,6691
4
+ olca/olcacli.py,sha256=OGt0-eC7UU5gIlCpSGE_Fp8vHPzg7AVnvrBqiECK03E,13515
5
+ olca/olcahelper.py,sha256=WdN6-K-N7-HnB9L_px6TsDKWiTXIusZM2I1d0GNQnFs,3322
6
+ olca/tracing.py,sha256=GSuXIKmIMQ9V2gLkKcin142Z2QpyS6obsnj8Tf-1zHc,1621
7
+ olca/utils.py,sha256=zM94HDMDYF95Yd9ubeOK6vuepbQN4kDFh0rTvaVFagI,912
8
+ olca-0.2.56.dist-info/LICENSE,sha256=gXf5dRMhNSbfLPYYTY_5hsZ1r7UU1OaKQEAQUhuIBkM,18092
9
+ olca-0.2.56.dist-info/METADATA,sha256=P9bTLFLFnHaUK9CHIVVvh3mWp1yeDi-t1lIJbnNHfGk,25311
10
+ olca-0.2.56.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
11
+ olca-0.2.56.dist-info/entry_points.txt,sha256=AhP5FMv6vnOq9C76V_vxRVIO50smnZXG4RIY47oD2_U,103
12
+ olca-0.2.56.dist-info/top_level.txt,sha256=bGDtAReS-xlS0F6MM-DyD0IQUqjNdWmgemnM3vNtrpI,5
13
+ olca-0.2.56.dist-info/RECORD,,
@@ -1,13 +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=OGt0-eC7UU5gIlCpSGE_Fp8vHPzg7AVnvrBqiECK03E,13515
5
- olca/olcahelper.py,sha256=WdN6-K-N7-HnB9L_px6TsDKWiTXIusZM2I1d0GNQnFs,3322
6
- olca/tracing.py,sha256=GSuXIKmIMQ9V2gLkKcin142Z2QpyS6obsnj8Tf-1zHc,1621
7
- olca/utils.py,sha256=zM94HDMDYF95Yd9ubeOK6vuepbQN4kDFh0rTvaVFagI,912
8
- olca-0.2.54.dist-info/LICENSE,sha256=gXf5dRMhNSbfLPYYTY_5hsZ1r7UU1OaKQEAQUhuIBkM,18092
9
- olca-0.2.54.dist-info/METADATA,sha256=T3zhwvIBzOHKURh-s8AV8EFAW6IiaQoDvBenRxC1FCA,25311
10
- olca-0.2.54.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
11
- olca-0.2.54.dist-info/entry_points.txt,sha256=AhP5FMv6vnOq9C76V_vxRVIO50smnZXG4RIY47oD2_U,103
12
- olca-0.2.54.dist-info/top_level.txt,sha256=bGDtAReS-xlS0F6MM-DyD0IQUqjNdWmgemnM3vNtrpI,5
13
- olca-0.2.54.dist-info/RECORD,,
File without changes
File without changes