Programmatically fetch logged data

If you want to fetch your logged data and metrics programmatically, you can do so via our Python clients:

import promptquality as pq
pq.login({YOUR CONSOLE URL})
project = pq.get_project_from_name(project_name="YOUR PROJECT NAME")
run = pq.get_run_from_name(run_name='YOUR RUN NAME', project_id=project.id)
rows =  pq.get_rows(project_id = project.id, run_id = run.id)

This will return traces (various nodes and node structure relationships) of a chain.

If you want to filter for the output from just the LLM 'chat' node, you can use the code snippet below:

rows = pq.get_rows()
for r in rows:
  if r.node_type=='chat':
    print(r) 

Last updated