You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: DEVELOPMENT.md
+3-15Lines changed: 3 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,7 +16,7 @@ You can run the tests on your local machine with:
16
16
hatch test
17
17
```
18
18
19
-
The [`test` command][hatch-test] supports options such as `-c` for measuring test coverage, `-a` for testing with a matrix of Python versions, and appending an argument like `tests/test_codex_tool.py::test_to_llamaindex_tool` for running a single test.
19
+
The [`test` command][hatch-test] supports options such as `-c` for measuring test coverage, `-a` for testing with a matrix of Python versions, and appending an argument like `tests/test_validator.py::test_validate_expert_answer` for running a single test.
You may want to build and install the package locally - for example, to see how your changes affect other Python code in a script or Jupyter notebook.
@@ -110,14 +109,3 @@ Testing, type checking, and formatting/linting is [checked in CI][ci].
110
109
To target a different Codex backend environment (i.e. staging or local), set the `CODEX_BASE_URL` environment variable. Example: `export CODEX_BASE_URL=http://localhost:8080`.
111
110
112
111
## Style guide
113
-
114
-
### Adding integrations with external libraries
115
-
116
-
When adding integrations with external libraries, always use a lazy import. The external dependency should not be required to use the `cleanlab-codex` library. Wrap the lazy import in a `try`/`except` block to catch the `ImportError` and raise a `MissingDependencyError` with a helpful message. See [codex_tool.py](src/cleanlab_codex/codex_tool.py) file for examples one of which is shown below:
117
-
118
-
```python
119
-
try:
120
-
from cleanlab_codex.utils.smolagents import CodexTool as SmolagentsCodexTool
121
-
exceptImportErroras e:
122
-
raise MissingDependencyError("smolagents", "https://github.com/huggingface/smolagents") from e
# Update your system prompt to include information on how to use the Codex tool
31
-
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."""
32
-
33
-
# Convert the Codex tool to a framework-specific tool
34
-
framework_specific_codex_tool = codex_tool.to_<framework_name>_tool() # i.e. codex_tool.to_llamaindex_tool(), codex_tool.to_openai_tool(), etc.
35
-
36
-
# Pass the Codex tool to your RAG/Agentic framework
if results["is_bad_response"] and results["expert_answer"]
36
+
else response # Your RAG system's initial response
37
+
)
38
38
```
39
39
40
-
(Note: Exact code will depend on the RAG/Agentic framework you are using. [Other integrations](https://help.cleanlab.ai/codex/concepts/integrations/) are available if you prefer to avoid Tool Calls.)
41
40
<!-- TODO: add demo video -->
42
-
<!-- Video should show Codex tool added to a RAG system, question asked that requires knowledge from an outside expert, Codex tool used to ask an outside expert, and expert response returned to the user -->
41
+
<!-- Video should show Codex added to a RAG system, question asked that requires knowledge from an outside expert, Codex used to ask an outside expert, and expert response returned to the user -->
43
42
44
43
## Why Codex?
45
44
-**Detect Knowledge Gaps and Hallucinations**: Codex identifies knowledge gaps and incorrect/untrustworthy responses in your AI application, to help you know which questions require expert input.
Copy file name to clipboardExpand all lines: src/cleanlab_codex/project.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -37,7 +37,7 @@ def __str__(self) -> str:
37
37
classProject:
38
38
"""Represents a Codex project.
39
39
40
-
To integrate a Codex project into your RAG/Agentic system, we recommend using one of our abstractions such as [`CodexTool`](/codex/api/python/codex_tool).
40
+
To integrate a Codex project into your RAG/Agentic system, we recommend using one of our abstractions such as [`Validator`](/codex/api/python/validator).
0 commit comments