File tree Expand file tree Collapse file tree
bootstraprag/templates/llamaindex/rag_with_self_correction_with_observability Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -10,6 +10,11 @@ OLLAMA_BASE_URL='http://localhost:11434'
1010OLLAMA_LLM_MODEL = ' llama3.1'
1111OLLAMA_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
1419CRITICAL = 50
1520FATAL = 50
Original file line number Diff line number Diff line change 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
Original file line number Diff line number Diff line change 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 `
Original file line number Diff line number Diff line change 11python-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
Original file line number Diff line number Diff line change 1212from llama_index .core .query_engine import RetryQueryEngine , RetrySourceQueryEngine , RetryGuidelineQueryEngine
1313from llama_index .core .evaluation import RelevancyEvaluator , GuidelineEvaluator
1414from llama_index .core .evaluation .guideline import DEFAULT_GUIDELINES
15+ from langfuse .llama_index import LlamaIndexInstrumentor
1516from rag_evaluator import RAGEvaluator
1617from dotenv import load_dotenv , find_dotenv
1718from typing import Union
1819import qdrant_client
19- import llama_index
20- import phoenix as px
2120import logging
2221import os
2322
2726logger = 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
3433class SelfCorrectingRAG :
You can’t perform that action at this time.
0 commit comments