/ Quickstart.md
Quickstart.md
  1  # Quickstart | RagaAI Catalyst
  2  
  3  ## **1. Install RagaAI Catalyst**
  4  
  5  To install the RagaAI Catalyst package, run the following command in your terminal:
  6  
  7  ```bash
  8  pip install ragaai-catalyst
  9  ```
 10  
 11  
 12  
 13  ## **2. Set Up Authentication Keys**
 14  
 15  ### **How to Get Your API Keys :**
 16  1. Log in to your account at [RagaAI Catalyst](https://catalyst.raga.ai/).
 17  2. Navigate to **Profile Settings** → **Authentication**.
 18  3. Click **Generate New Key** to obtain your **Access Key** and **Secret Key**.
 19  
 20  ### **Initialize the SDK**
 21  
 22  To begin using Catalyst, initialize it as follows:
 23  
 24  ```python
 25  from ragaai_catalyst import RagaAICatalyst
 26  
 27  catalyst = RagaAICatalyst(
 28      access_key="YOUR_ACCESS_KEY",  # Replace with your access key
 29      secret_key="YOUR_SECRET_KEY",  # Replace with your secret key
 30      base_url="BASE_URL"  
 31  )
 32  ```
 33  
 34  
 35  ## **3. Create Your First Project**
 36  
 37  Create a new project and choose a use case from the available options:
 38  
 39  ```python
 40  # Create a new project
 41  project = catalyst.create_project(
 42      project_name="Project_Name",
 43      usecase="Q/A"  # Options : Chatbot, Q/A, Others, Agentic Application
 44  )
 45  
 46  # List available use cases
 47  print(catalyst.project_use_cases())
 48  ```
 49  
 50  ### **Add a Dataset**
 51  Initialize the dataset manager and create a dataset from a CSV file, DataFrame, or JSONl file.
 52  
 53  Define a **schema mapping** for the dataset.
 54  
 55  ```python
 56  from ragaai_catalyst import Dataset
 57  
 58  # Initialize dataset manager
 59  dataset_manager = Dataset(project_name="Project_Name")
 60  
 61  # Create dataset from a CSV file
 62  dataset_manager.create_from_csv(
 63      csv_path="path/to/your.csv",
 64      dataset_name="MyDataset",
 65      schema_mapping={
 66          'column1': 'schema_element1',
 67          'column2': 'schema_element2'
 68      }
 69  )
 70  
 71  # View dataset schema
 72  print(dataset_manager.get_schema_mapping())
 73  ```
 74  
 75  
 76  ## **4. Trace Your Application**
 77  
 78  
 79  
 80  ### **Auto-Instrumentation**
 81  
 82  Auto-Instrumentation automatically traces your application after initializing the correct tracer.
 83  
 84  #### **Implementation**
 85  
 86  ```python
 87  from ragaai_catalyst import init_tracing, Tracer
 88  
 89  # Initialize the tracer 
 90  tracer = Tracer(
 91      project_name="Project_Name",
 92      dataset_name="Dataset_Name",
 93      tracer_type="agentic/langgraph"  
 94  )
 95  
 96  # Enable auto-instrumentation
 97  init_tracing(catalyst=catalyst, tracer=tracer)
 98  ```
 99  
100  #### **Supported Tracer Types**
101  
102  Choose from the given supported tracer types based on your framework:
103  
104  - `agentic/langgraph`
105  - `agentic/langchain`
106  - `agentic/smolagents`
107  - `agentic/openai_agents`
108  - `agentic/llamaindex`
109  - `agentic/haystack`
110  
111  ---
112  
113  
114  
115  ### Custom Tracing
116  
117  You can enable custom tracing in two ways:
118  
119  1. Using the `with tracer()` function.
120  2. Manually starting and stopping the tracer with `tracer.start()` and `tracer.stop()`.
121  
122  ```python
123  from ragaai_catalyst import Tracer
124  
125  # Initialize production tracer
126  tracer = Tracer(
127      project_name="Project_Name",
128      dataset_name="tracer_dataset_name",
129      tracer_type="tracer_type"
130  )
131  
132  # Start a trace recording (Option 1)
133  with tracer():
134      # Your code here
135  
136  # Start a trace recording (Option 2)
137  tracer.start()
138  
139  # Your code here
140  
141  # Stop the trace recording
142  tracer.stop()
143  
144  # Verify data capture
145  print(tracer.get_upload_status())
146  ```
147  
148  
149  
150  ## **5. Evaluation Framework**
151  
152  
153  1. Import `Evaluation` from `ragaai_catalyst`.
154  2. Configure evaluation metrics.
155  3. Add metrics from the available options.
156  4. Check the status and retrieve results after running the evaluation.
157  
158  ```python
159  from ragaai_catalyst import Evaluation
160  
161  # Initialize evaluation engine
162  evaluation = Evaluation(
163      project_name="Project_Name",
164      dataset_name="MyDataset"
165  )
166  
167  # Define Schema-mapping
168  
169  schema_mapping = {
170      'Query': 'prompt',
171      'response': 'response',
172      'Context': 'context',
173      'expectedResponse': 'expected_response'
174  }
175  
176  evaluation.add_metrics(
177      metrics=[
178          {
179              "name": "Faithfulness",
180              "config": {"model": "gpt-4o-mini", "provider": "openai", "threshold": {"gte": 0.232323}},
181              "column_name": "Faithfulness_v1",
182              "schema_mapping": schema_mapping
183          }
184      ]
185  )
186  
187  # Get status and results
188  
189  print(f"Status: {evaluation.get_status()}")
190  print(f"Results: {evaluation.get_results()}")
191  ```
192  
193  
194  
195  ## **Next Steps**
196  - **Explore the Dashboard:** Visualize metrics and insights in the RagaAI Web UI.
197  
198  
199  
200  **Version:** 1.0.0 | **Last Updated:** Mar 2025