File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -18,21 +18,21 @@ pip install cleanlab-codex
1818Integrating Codex into your RAG application is as simple as:
1919
2020``` python
21- from cleanlab_codex import Validator
22- validator = Validator( codex_access_key = ... ) # optional configurations can improve accuracy/latency
21+ from cleanlab_codex import Project
22+ project = Project.from_access_key( ... )
2323
2424# Your existing RAG code:
2525context = rag_retrieve_context(user_query)
2626prompt = rag_form_prompt(user_query, retrieved_context)
2727response = rag_generate_response(prompt)
2828
2929# Detect bad responses and remediate with Cleanlab
30- results = validator .validate(query = query, context = context, response = response,
31- form_prompt = rag_form_prompt )
30+ results = project .validate(query = query, context = context, response = response,
31+ messages = [ ... , prompt] )
3232
3333final_response = (
3434 results[" expert_answer" ] # Codex's answer
35- if results[" is_bad_response " ] and results[ " expert_answer " ]
35+ if results[" expert_answer " ] is not None
3636 else response # Your RAG system's initial response
3737)
3838```
You can’t perform that action at this time.
0 commit comments