Skip to content

Commit c2a14c4

Browse files
pavanjavapavanmantha
andauthored
Observability migration (#66)
* -tested and upgraded version * -implemented ragas evals * -implemented ragas evals * -implemented rag with llama_parse * -added rag with llama_parse in cli * -changed version * -modified the main doc * -modified the main doc * -migrated observability to Langfuse * -removed keys * -kept samples keys for reference * -integrated langfuse observability * -integrated langfuse observability --------- Co-authored-by: pavanmantha <pavan.mantha@thevaslabs.io>
1 parent 0c7f186 commit c2a14c4

5 files changed

Lines changed: 66 additions & 18 deletions

File tree

bootstraprag/templates/llamaindex/rag_with_self_correction_with_observability/.env

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ OLLAMA_BASE_URL='http://localhost:11434'
1010
OLLAMA_LLM_MODEL='llama3.1'
1111
OLLAMA_EMBED_MODEL='nomic-embed-text:latest'
1212

13+
# Langfuse Observability Details
14+
LANGFUSE_PUBLIC_KEY='pk-lf-'
15+
LANGFUSE_SECRET_KEY='sk-lf-'
16+
LANGFUSE_HOST='http://localhost:3000'
17+
1318
# logger can be controlled usiing env
1419
CRITICAL = 50
1520
FATAL = 50
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
version: '3.8'
2+
3+
services:
4+
postgres:
5+
image: postgres:13
6+
container_name: postgres
7+
environment:
8+
POSTGRES_USER: admin
9+
POSTGRES_PASSWORD: admin@123
10+
POSTGRES_DB: langfuse
11+
volumes:
12+
- postgres_data:/var/lib/postgresql/data
13+
networks:
14+
- langfuse-network
15+
16+
langfuse:
17+
image: langfuse/langfuse:latest
18+
container_name: langfuse
19+
environment:
20+
DATABASE_URL: postgresql://hello:mysecretpassword@postgres:5432/langfuse
21+
NEXTAUTH_URL: http://localhost:3000
22+
NEXTAUTH_SECRET: mysecret
23+
SALT: mysalt
24+
ENCRYPTION_KEY: 98637d42c277ef10b8a324e25d492daa8eee8f769574124ba25132f71481f183
25+
ports:
26+
- "3000:3000"
27+
depends_on:
28+
- postgres
29+
networks:
30+
- langfuse-network
31+
32+
volumes:
33+
postgres_data:
34+
35+
networks:
36+
langfuse-network:
37+
driver: bridge

bootstraprag/templates/llamaindex/rag_with_self_correction_with_observability/readme.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
1-
## Instructions to run the code
2-
1+
## Self-Correcting RAG
2+
#### How to spin observability
3+
- run `docker compose -f docker-compose-langfuse.yml up`
4+
- launch langfuse in browser `http://localhost:3000`
5+
- click on `signup`
6+
- create `organization` & `project`
7+
- once done create your `public` and `private` api keys
8+
-
9+
#### Instructions to run the code
310
- Navigate to the root of the project and run the below command
411
- `pip install -r requirements.txt`
512
- open `.env` file update your qdrant url `DB_URL` & password `DB_API_KEY`
Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
python-dotenv==1.0.1
2-
llama-index==0.11.7
3-
llama-index-llms-openai==0.2.3
4-
llama-index-llms-ollama==0.3.1
5-
llama-index-embeddings-openai==0.2.4
6-
llama-index-embeddings-ollama==0.3.0
7-
llama-index-vector-stores-qdrant==0.3.0
8-
llama-index-callbacks-arize-phoenix==0.2.1
9-
qdrant-client==1.11.1
10-
pydantic==2.9.0
11-
arize-phoenix==4.33.1
12-
litserve==0.2.2
13-
deepeval==1.3.2
2+
llama-index==0.11.19
3+
llama-index-llms-openai==0.2.16
4+
llama-index-llms-ollama==0.3.4
5+
llama-index-embeddings-openai==0.2.5
6+
llama-index-embeddings-ollama==0.3.1
7+
llama-index-vector-stores-qdrant==0.3.2
8+
qdrant-client==1.12.0
9+
pydantic==2.9.2
10+
litserve==0.2.3
11+
deepeval==1.4.4
12+
# observability
13+
langfuse==2.52.2

bootstraprag/templates/llamaindex/rag_with_self_correction_with_observability/self_correction_core.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,11 @@
1212
from llama_index.core.query_engine import RetryQueryEngine, RetrySourceQueryEngine, RetryGuidelineQueryEngine
1313
from llama_index.core.evaluation import RelevancyEvaluator, GuidelineEvaluator
1414
from llama_index.core.evaluation.guideline import DEFAULT_GUIDELINES
15+
from langfuse.llama_index import LlamaIndexInstrumentor
1516
from rag_evaluator import RAGEvaluator
1617
from dotenv import load_dotenv, find_dotenv
1718
from typing import Union
1819
import qdrant_client
19-
import llama_index
20-
import phoenix as px
2120
import logging
2221
import os
2322

@@ -27,8 +26,8 @@
2726
logger = logging.getLogger(__name__)
2827

2928
# instrumenting observability
30-
session = px.launch_app()
31-
llama_index.core.set_global_handler("arize_phoenix")
29+
instrumentor = LlamaIndexInstrumentor()
30+
instrumentor.start()
3231

3332

3433
class SelfCorrectingRAG:

0 commit comments

Comments
 (0)