Skip to content

Commit

Permalink
deploy: bed1dc9
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Jul 4, 2024
1 parent d1e791c commit e6530a9
Show file tree
Hide file tree
Showing 8 changed files with 64 additions and 9 deletions.
Binary file modified .doctrees/apis/components/components.agent.doctree
Binary file not shown.
Binary file modified .doctrees/environment.pickle
Binary file not shown.
6 changes: 3 additions & 3 deletions _modules/components/agent/react.html
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ <h1>Source code for components.agent.react</h1><div class="highlight"><pre>


<div class="viewcode-block" id="ReActAgent">
<a class="viewcode-back" href="../../../apis/components/_autosummary/components.agent.react.html#components.agent.react.ReActAgent">[docs]</a>
<a class="viewcode-back" href="../../../apis/components/components.agent.html#components.agent.react.ReActAgent">[docs]</a>
<span class="k">class</span> <span class="nc">ReActAgent</span><span class="p">(</span><span class="n">Component</span><span class="p">):</span>
<span class="vm">__doc__</span> <span class="o">=</span> <span class="sa">r</span><span class="s2">&quot;&quot;&quot;ReActAgent uses generator as a planner that runs multiple and sequential functional call steps to generate the final response.</span>

Expand Down Expand Up @@ -641,7 +641,7 @@ <h1>Source code for components.agent.react</h1><div class="highlight"><pre>
<span class="bp">self</span><span class="o">.</span><span class="n">tool_manager</span> <span class="o">=</span> <span class="n">ToolManager</span><span class="p">(</span><span class="n">tools</span><span class="o">=</span><span class="n">tools</span><span class="p">)</span>

<div class="viewcode-block" id="ReActAgent.reset">
<a class="viewcode-back" href="../../../apis/components/_autosummary/components.agent.react.html#components.agent.react.ReActAgent.reset">[docs]</a>
<a class="viewcode-back" href="../../../apis/components/components.agent.html#components.agent.react.ReActAgent.reset">[docs]</a>
<span class="k">def</span> <span class="nf">reset</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="w"> </span><span class="sa">r</span><span class="sd">&quot;&quot;&quot;Reset the agent to start a new query.&quot;&quot;&quot;</span>
<span class="bp">self</span><span class="o">.</span><span class="n">step_history</span> <span class="o">=</span> <span class="p">[]</span></div>
Expand Down Expand Up @@ -710,7 +710,7 @@ <h1>Source code for components.agent.react</h1><div class="highlight"><pre>
<span class="k">return</span> <span class="n">response</span>

<div class="viewcode-block" id="ReActAgent.call">
<a class="viewcode-back" href="../../../apis/components/_autosummary/components.agent.react.html#components.agent.react.ReActAgent.call">[docs]</a>
<a class="viewcode-back" href="../../../apis/components/components.agent.html#components.agent.react.ReActAgent.call">[docs]</a>
<span class="k">def</span> <span class="nf">call</span><span class="p">(</span>
<span class="bp">self</span><span class="p">,</span>
<span class="nb">input</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span>
Expand Down
37 changes: 37 additions & 0 deletions apis/components/components.agent.html
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,38 @@ <h2>Submodules<a class="headerlink" href="#submodules" title="Link to this headi
<div class="toctree-wrapper compound">
</div>
<hr class="docutils" />
<dl class="py class" id="module-components.agent">
<dt class="sig sig-object py" id="components.agent.ReActAgent">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">ReActAgent</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">tools</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">List</span><span class="p"><span class="pre">[</span></span><span class="pre">Callable</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">Callable</span><span class="p"><span class="pre">[</span></span><span class="p"><span class="pre">[</span></span><span class="p"><span class="pre">...</span></span><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="pre">Awaitable</span><span class="p"><span class="pre">[</span></span><span class="pre">Any</span><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">]</span></span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">FunctionTool</span><span class="p"><span class="pre">]</span></span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">[]</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">max_steps</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">10</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">add_llm_as_fallback</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">bool</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">True</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">model_client</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">ModelClient</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">model_kwargs</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Dict</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">{}</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../../_modules/components/agent/react.html#ReActAgent"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#components.agent.ReActAgent" title="Link to this definition">#</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">Component</span></code></p>
<p>ReActAgent uses generator as a planner that runs multiple and sequential functional call steps to generate the final response.</p>
<p>Users need to set up:
- tools: a list of tools to use to complete the task. Each tool is a function or a function tool.
- max_steps: the maximum number of steps the agent can take to complete the task.
- use_llm_as_fallback: a boolean to decide whether to use an additional LLM model as a fallback tool to answer the query.
- model_client: the model client to use to generate the response.
- model_kwargs: the model kwargs to use to generate the response.</p>
<p>For the generator, the default arguments are:
(1) default prompt: DEFAULT_REACT_AGENT_SYSTEM_PROMPT
(2) default output_processors: JsonParser</p>
<p>There are <cite>examples</cite> which is optional, a list of string examples in the prompt.</p>
<p>Example:</p>
<p>Reference:
[1] <a class="reference external" href="https://arxiv.org/abs/2210.03629">https://arxiv.org/abs/2210.03629</a>, published in Mar, 2023.</p>
<dl class="py method">
<dt class="sig sig-object py" id="components.agent.ReActAgent.reset">
<span class="sig-name descname"><span class="pre">reset</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../../_modules/components/agent/react.html#ReActAgent.reset"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#components.agent.ReActAgent.reset" title="Link to this definition">#</a></dt>
<dd><p>Reset the agent to start a new query.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="components.agent.ReActAgent.call">
<span class="sig-name descname"><span class="pre">call</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">input</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">promt_kwargs</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Dict</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">None</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">{}</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">model_kwargs</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Dict</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">None</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">{}</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">Any</span></span></span><a class="reference internal" href="../../_modules/components/agent/react.html#ReActAgent.call"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#components.agent.ReActAgent.call" title="Link to this definition">#</a></dt>
<dd><p>prompt_kwargs: additional prompt kwargs to either replace or add to the preset prompt kwargs.</p>
</dd></dl>

</dd></dl>

</section>
</section>

Expand Down Expand Up @@ -606,6 +638,11 @@ <h2>Submodules<a class="headerlink" href="#submodules" title="Link to this headi
<nav class="bd-toc-nav page-toc" aria-labelledby="pst-page-navigation-heading-2">
<ul class="visible nav section-nav flex-column">
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#submodules">Submodules</a><ul class="nav section-nav flex-column">
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#components.agent.ReActAgent"><code class="docutils literal notranslate"><span class="pre">ReActAgent</span></code></a><ul class="nav section-nav flex-column">
<li class="toc-h4 nav-item toc-entry"><a class="reference internal nav-link" href="#components.agent.ReActAgent.reset"><code class="docutils literal notranslate"><span class="pre">ReActAgent.reset()</span></code></a></li>
<li class="toc-h4 nav-item toc-entry"><a class="reference internal nav-link" href="#components.agent.ReActAgent.call"><code class="docutils literal notranslate"><span class="pre">ReActAgent.call()</span></code></a></li>
</ul>
</li>
</ul>
</li>
</ul>
Expand Down
23 changes: 18 additions & 5 deletions genindex.html
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ <h2 id="C">C</h2>
</li>
<li><a href="apis/optim/optim.sampler.html#optim.sampler.RandomSampler.call">(RandomSampler method)</a>
</li>
<li><a href="apis/components/None/components.agent.react.html#components.agent.react.ReActAgent.call">(ReActAgent method)</a>, <a href="apis/components/_autosummary/components.agent.react.html#components.agent.react.ReActAgent.call">[1]</a>
<li><a href="apis/components/None/components.agent.react.html#components.agent.react.ReActAgent.call">(ReActAgent method)</a>, <a href="apis/components/_autosummary/components.agent.react.html#components.agent.react.ReActAgent.call">[1]</a>, <a href="apis/components/components.agent.html#components.agent.ReActAgent.call">[2]</a>
</li>
<li><a href="apis/components/None/components.retriever.reranker_retriever.html#components.retriever.reranker_retriever.RerankerRetriever.call">(RerankerRetriever method)</a>, <a href="apis/components/_autosummary/components.retriever.reranker_retriever.html#components.retriever.reranker_retriever.RerankerRetriever.call">[1]</a>, <a href="apis/components/components.retriever.html#components.retriever.RerankerRetriever.call">[2]</a>
</li>
Expand Down Expand Up @@ -608,6 +608,13 @@ <h2 id="C">C</h2>
<li><a href="apis/core/core.component.html#core.component.Component.components">components() (Component method)</a>
</li>
<li>
components.agent

<ul>
<li><a href="apis/components/components.agent.html#module-components.agent">module</a>
</li>
</ul></li>
<li>
components.agent.react

<ul>
Expand Down Expand Up @@ -691,15 +698,15 @@ <h2 id="C">C</h2>
<li><a href="apis/components/None/components.model_client.transformers_client.html#module-components.model_client.transformers_client">module</a>, <a href="apis/components/_autosummary/components.model_client.transformers_client.html#module-components.model_client.transformers_client">[1]</a>
</li>
</ul></li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li>
components.model_client.utils

<ul>
<li><a href="apis/components/_autosummary/components.model_client.utils.html#module-components.model_client.utils">module</a>
</li>
</ul></li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li>
components.output_parsers

Expand Down Expand Up @@ -1514,6 +1521,8 @@ <h2 id="M">M</h2>
module

<ul>
<li><a href="apis/components/components.agent.html#module-components.agent">components.agent</a>
</li>
<li><a href="apis/components/None/components.agent.react.html#module-components.agent.react">components.agent.react</a>, <a href="apis/components/_autosummary/components.agent.react.html#module-components.agent.react">[1]</a>
</li>
<li><a href="apis/components/components.data_process.html#module-components.data_process">components.data_process</a>
Expand Down Expand Up @@ -1852,8 +1861,12 @@ <h2 id="R">R</h2>
<li><a href="apis/core/core.types.html#core.types.GeneratorOutput.raw_response">(GeneratorOutput attribute)</a>
</li>
</ul></li>
<li><a href="apis/components/None/components.agent.react.html#components.agent.react.ReActAgent">ReActAgent (class in components.agent.react)</a>, <a href="apis/components/_autosummary/components.agent.react.html#components.agent.react.ReActAgent">[1]</a>
<li><a href="apis/components/components.agent.html#components.agent.ReActAgent">ReActAgent (class in components.agent)</a>

<ul>
<li><a href="apis/components/None/components.agent.react.html#components.agent.react.ReActAgent">(class in components.agent.react)</a>, <a href="apis/components/_autosummary/components.agent.react.html#components.agent.react.ReActAgent">[1]</a>
</li>
</ul></li>
<li><a href="apis/utils/utils.registry.html#utils.registry.EntityMapping.register">register() (EntityMapping class method)</a>
</li>
<li><a href="apis/core/core.component.html#core.component.Component.register_component">register_component() (Component method)</a>
Expand Down Expand Up @@ -1885,7 +1898,7 @@ <h2 id="R">R</h2>
</li>
<li><a href="apis/core/core.db.html#core.db.LocalDB.reset">(LocalDB method)</a>
</li>
<li><a href="apis/components/None/components.agent.react.html#components.agent.react.ReActAgent.reset">(ReActAgent method)</a>, <a href="apis/components/_autosummary/components.agent.react.html#components.agent.react.ReActAgent.reset">[1]</a>
<li><a href="apis/components/None/components.agent.react.html#components.agent.react.ReActAgent.reset">(ReActAgent method)</a>, <a href="apis/components/_autosummary/components.agent.react.html#components.agent.react.ReActAgent.reset">[1]</a>, <a href="apis/components/components.agent.html#components.agent.ReActAgent.reset">[2]</a>
</li>
</ul></li>
<li><a href="apis/components/None/components.retriever.bm25_retriever.html#components.retriever.bm25_retriever.BM25Retriever.reset_index">reset_index() (BM25Retriever method)</a>, <a href="apis/components/_autosummary/components.retriever.bm25_retriever.html#components.retriever.bm25_retriever.BM25Retriever.reset_index">[1]</a>, <a href="apis/components/components.retriever.html#components.retriever.BM25Retriever.reset_index">[2]</a>
Expand Down
Binary file modified objects.inv
Binary file not shown.
5 changes: 5 additions & 0 deletions py-modindex.html
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,11 @@ <h1>Python Module Index</h1>
<td>
<code class="xref">components</code></td><td>
<em></em></td></tr>
<tr class="cg-1">
<td></td>
<td>&#160;&#160;&#160;
<a href="apis/components/components.agent.html#module-components.agent"><code class="xref">components.agent</code></a></td><td>
<em></em></td></tr>
<tr class="cg-1">
<td></td>
<td>&#160;&#160;&#160;
Expand Down
2 changes: 1 addition & 1 deletion searchindex.js

Large diffs are not rendered by default.

0 comments on commit e6530a9

Please sign in to comment.