Skip to content

Commit 558c5fe

Browse files
authored
update demo code in readme (#114)
1 parent 3ef4bd5 commit 558c5fe

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,21 @@ pip install cleanlab-codex
1818
Integrating 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:
2525
context = rag_retrieve_context(user_query)
2626
prompt = rag_form_prompt(user_query, retrieved_context)
2727
response = 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

3333
final_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
```

0 commit comments

Comments
 (0)