Skip to content

Commit

Permalink
Merge pull request #47 from SylphAI-Inc/xiaoyi_doc
Browse files Browse the repository at this point in the history
ReAct Agent Tutorial + Website CSS Style
  • Loading branch information
Alleria1809 authored Jun 23, 2024
2 parents be8cfb7 + f1cab05 commit 7a83f7b
Show file tree
Hide file tree
Showing 37 changed files with 2,703 additions and 318 deletions.
94 changes: 94 additions & 0 deletions docs/source/_static/css/custom.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
/* custom.css */

:root {
--pst-color-info: 23, 162, 184;
--pst-color-logo: #2EB5EB;
--bs-gray-500:#adb5bd;

}
p {
font-size: 0.9em;
margin-bottom: 1.15rem;
}

html[data-theme=light] {
--pst-color-secondary: #3d3d3d; /*change the secondary color, header link to gray */
--pst-color-link-hover: #25262; /*change the side bar link color to black */
--pst-color-table-row-hover-bg: #f8f9fa; /*change the table row hover color to light gray */
--sd-color-secondary: gray; /*change the secondary color to black */
--sd-color-secondary-highlight: gray; /*change the secondary highlight color to black */
}

.bd-main .bd-content .bd-article-container {
max-width: 100%; /* default is 60em */
}

h1{
font-size: 2rem; /* make the h1 in the code smaller */
}
/* .bd-page-width {
max-width: 100%;
} */

.sig-name {
color: black; /* set the class name and attributes to black */
}
.caption-text {
font-size: 14px; /* Sets the smallest font size */
color: gray; /* Sets the color to gray */
}
.bd-links__title {
/* remove the "section navigation" string*/
display: none;
}

table {
width: auto; /* Override fit-content which breaks Styler user guide ipynb */
}

/* Main index page overview cards */

.intro-card {
padding: 30px 10px 20px 10px;
}

.intro-card .sd-card-img-top {
margin: 10px;
height: 52px;
background: none !important;
}

.intro-card .sd-card-title {
color: var(--pst-color-primary);
font-size: var(--pst-font-size-h5);
padding: 1rem 0rem 0.5rem 0rem;
}

.intro-card .sd-card-footer {
border: none !important;
}

.intro-card .sd-card-footer p.sd-card-text {
max-width: 220px;
margin-left: auto;
margin-right: auto;
}

.intro-card .sd-btn-secondary {
background-color: #6c757d !important;
border-color: #6c757d !important;
}

.intro-card .sd-btn-secondary:hover {
background-color: #5a6268 !important;
border-color: #545b62 !important;
}

.card, .card img {
background-color: var(--pst-color-background);
}

/* Remove hover effect from table rows */
table tr:hover {
background-color: transparent !important;
}
93 changes: 0 additions & 93 deletions docs/source/_static/custom.css

This file was deleted.

File renamed without changes
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/source/_static/images/LightRAG-logo-doc.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/source/_static/images/LightRAG-logo.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/source/_static/images/LightRAG_dataflow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/source/_static/images/ReAct.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
71 changes: 71 additions & 0 deletions docs/source/apis/components/agent_prompt.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
.. _agent_prompt:

.. _DEFAULT_REACT_AGENT_SYSTEM_PROMPT:

DEFAULT_REACT_AGENT_SYSTEM_PROMPT
----------------------------------

This is the default prompt used by the system to interact with the agents. It contains the following structure:

.. code-block:: python
DEFAULT_REACT_AGENT_SYSTEM_PROMPT = r"""
{# role/task description #}
You task is to answer user's query with minimum steps and maximum accuracy using the tools provided.
{# REACT instructions #}
Each step you will read the previous Thought, Action, and Observation(execution result of the action)steps and then provide the next Thought and Action.
You only have access to the following tools:
{# tools #}
{% for tool in tools %}
{{ loop.index }}. ToolName: {{ tool.metadata.name }}
Tool Description: {{ tool.metadata.description }}
Tool Parameters: {{ tool.metadata.fn_schema_str }} {#tool args can be misleading, especially if we already have type hints and docstring in the function#}
{% endfor %}
{# output is always more robust to use json than string #}
---
Your output must be in valid JSON format(raw Python string format) with two keys:
{
"thought": "<Why you are taking this action>",
"action": "ToolName(<args>, <kwargs>)"
}
- Must double quote the JSON str.
- Inside of the JSON str, Must use escape double quote and escape backslash for string.
For example:
"action": "finish(\"John's.\")"
---
{# Specifications TODO: preference between the usage of llm tool vs the other tool #}
Process:
- Step 1: Read the user query and potentially divide it into subqueries. And get started with the first subquery.
- Call one available tool at a time to solve each subquery/subquestion. \
- At step 'finish', join all subqueries answers and finish the task.
Remember:
- Action must call one of the above tools with Took Name. It can not be empty.
- Read the Tool Description and ensure your args and kwarg follow what each tool expects in types. e.g. (a=1, b=2) if it is keyword argument or (1, 2) if it is positional.
- You will always end with 'finish' action to finish the task. The answer can be the final answer or failure message.
- When the initial query is simple, use minimum steps to answer the query.
{#Examples can be here#}
{# Check if there are any examples #}
{% if examples %}
<EXAMPLES>
{% for example in examples %}
{{ example }}
{% endfor %}
</EXAMPLES>
{% endif %}
<</SYS>>
-----------------
{# History #}
{% for history in step_history %}
Step {{history.step}}:
{
"thought": "{{history.thought}}",
"action": "{{history.action}}",
}
"observation": "{{history.observation}}"
{% endfor %}
{% if input_str %}
User query:
{{ input_str }}
{% endif %}
"""
2 changes: 1 addition & 1 deletion docs/source/apis/components/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Agents
components.agent

Model Clients
-----------
-----------------
.. toctree::
:maxdepth: 1

Expand Down
4 changes: 3 additions & 1 deletion docs/source/apis/core/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Overview
core.prompt_builder
core.retriever
core.string_parser
core.text_splitter
core.tokenizer
core.tool_helper
core.types
Expand Down Expand Up @@ -66,7 +67,8 @@ Document Processing
.. toctree::
:maxdepth: 1

core.document_splitter
.. core.document_splitter
core.text_splitter

Embedding and Retrieval
-----------------------
Expand Down
Loading

0 comments on commit 7a83f7b

Please sign in to comment.