Codex enables you to seamlessly leverage knowledge from Subject Matter Experts (SMEs) to improve your RAG/Agentic applications.
The cleanlab-codex
library provides a simple interface to integrate Codex's capabilities into your RAG application.
See immediate impact with just a few lines of code!
Install the package:
pip install cleanlab-codex
Integrating Codex into your RAG application as a tool is as simple as:
from cleanlab_codex import CodexTool
def rag(question, system_prompt, tools) -> str:
"""Your RAG/Agentic code here"""
...
# Initialize the Codex tool
codex_tool = CodexTool.from_access_key("your-access-key")
# Update your system prompt to include information on how to use the Codex tool
system_prompt = f"""Answer the user's Question based on the following Context. If the Context doesn't adequately address the Question, use the {codex_tool.tool_name} tool to ask an outside expert."""
# Convert the Codex tool to a framework-specific tool
framework_specific_codex_tool = codex_tool.to_<framework_name>_tool() # i.e. codex_tool.to_llamaindex_tool(), codex_tool.to_openai_tool(), etc.
# Pass the Codex tool to your RAG/Agentic framework
response = rag(question, system_prompt, [framework_specific_codex_tool])
(Note: exact code will depend on the RAG/Agentic framework you are using)
- Identify Knowledge Gaps: Codex captures knowledge gaps in your application so that you can easily identify which questions require expert input.
- Efficiently Leverage SMEs: Codex ensures the SMEs see the most critical knowledge gaps first.
- Easy Integration: Integrate Codex into your RAG/Agentic application with just a few lines of code.
- Immediate Impact: SME responses instantly enhance your AI applications.
Comprehensive documentation along with tutorials and examples can be found here.
cleanlab-codex
is distributed under the terms of the MIT license.