Skip to content

Commit 14ac5a6

Browse files
authored
Merge pull request #211 from raga-ai-hub/v2.1.7
v2.1.7
2 parents 5989645 + 30a616a commit 14ac5a6

File tree

103 files changed

+6951
-2532
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+6951
-2532
lines changed

.github/workflows/ci.yml

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
name: CI Pipeline
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
code-quality:
11+
runs-on: ubuntu-latest
12+
continue-on-error: true
13+
steps:
14+
- uses: actions/checkout@v4
15+
- name: Set up Python
16+
uses: actions/setup-python@v5
17+
with:
18+
python-version: '3.10'
19+
- name: Install dependencies
20+
shell: bash
21+
run: |
22+
if [ "$RUNNER_OS" == "Windows" ]; then
23+
python -m pip install --upgrade pip
24+
pip install ruff
25+
pip install -e ".[dev]"
26+
else
27+
curl -LsSf https://astral.sh/uv/install.sh | sh
28+
export PATH="$HOME/.cargo/bin:$PATH"
29+
uv pip install --system ruff
30+
uv pip install --system -e ".[dev]"
31+
fi
32+
- name: Format and lint with Ruff
33+
run: |
34+
# First run format to fix formatting issues
35+
ruff format .
36+
# Then run check with auto-fix for fixable issues
37+
ruff check --fix .
38+
39+
test:
40+
needs: code-quality
41+
continue-on-error: true
42+
strategy:
43+
fail-fast: false
44+
matrix:
45+
os: [ubuntu-latest, windows-latest, macos-latest]
46+
python-version: ['3.10', '3.11', '3.12', '3.13']
47+
runs-on: ${{ matrix.os }}
48+
outputs:
49+
test_summary: ${{ steps.pytest.outputs.test_summary }}
50+
steps:
51+
- uses: actions/checkout@v4
52+
- name: Set up Python ${{ matrix.python-version }}
53+
uses: actions/setup-python@v5
54+
with:
55+
python-version: ${{ matrix.python-version }}
56+
- name: Install dependencies
57+
shell: bash
58+
run: |
59+
if [ "$RUNNER_OS" == "Windows" ]; then
60+
python -m pip install --upgrade pip
61+
pip install pytest pytest-cov
62+
pip install -r tests_requirements.txt
63+
pip install -e ".[dev]"
64+
else
65+
curl -LsSf https://astral.sh/uv/install.sh | sh
66+
export PATH="$HOME/.cargo/bin:$PATH"
67+
uv pip install --system pytest pytest-cov
68+
uv pip install --system -r tests_requirements.txt
69+
uv pip install --system -e ".[dev]"
70+
fi
71+
- name: Test with pytest
72+
id: pytest
73+
env:
74+
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
75+
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
76+
GROQ_API_KEY: ${{ secrets.GROQ_API_KEY }}
77+
AZURE_OPENAI_ENDPOINT: ${{ secrets.AZURE_OPENAI_ENDPOINT }}
78+
AZURE_OPENAI_API_KEY: ${{ secrets.AZURE_OPENAI_API_KEY }}
79+
AZURE_OPENAI_API_VERSION: ${{ secrets.AZURE_OPENAI_API_VERSION }}
80+
GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }}
81+
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
82+
PROJECT_NAME: ${{ secrets.PROJECT_NAME }}
83+
LOCATION: ${{ secrets.LOCATION }}
84+
RAGAAI_CATALYST_BASE_URL: ${{ secrets.RAGAAI_CATALYST_BASE_URL }}
85+
RAGAAI_CATALYST_ACCESS_KEY: ${{ secrets.RAGAAI_CATALYST_ACCESS_KEY }}
86+
RAGAAI_CATALYST_SECRET_KEY: ${{ secrets.RAGAAI_CATALYST_SECRET_KEY }}
87+
RAGAAI_PROJECT_NAME: ${{ secrets.RAGAAI_PROJECT_NAME }}
88+
RAGAAI_DATASET_NAME: ${{ secrets.RAGAAI_DATASET_NAME }}_$(date +'%Y%m%d%H%M%S')
89+
TAVILY_API_KEY: ${{ secrets.TAVILY_API_KEY }}
90+
SERPERDEV_API_KEY: ${{ secrets.SERPERDEV_API_KEY }}
91+
run: |
92+
mkdir -p test-results
93+
pytest tests/ -v --junitxml=test-results/junit.xml | tee test-output.txt
94+
echo "test_summary<<EOF" >> $GITHUB_OUTPUT
95+
echo "### Test Results for ${{ matrix.os }} - Python ${{ matrix.python-version }}" >> $GITHUB_OUTPUT
96+
echo '```' >> $GITHUB_OUTPUT
97+
cat test-output.txt | grep -E "collected|PASSED|FAILED|ERROR|SKIPPED" >> $GITHUB_OUTPUT
98+
echo '```' >> $GITHUB_OUTPUT
99+
echo "EOF" >> $GITHUB_OUTPUT

Quickstart.md

Lines changed: 200 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,200 @@
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

0 commit comments

Comments
 (0)