Skip to content

Commit

Permalink
deploy: 09a93d8
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Jul 23, 2024
1 parent cad45bc commit 55dc707
Show file tree
Hide file tree
Showing 30 changed files with 49 additions and 3,163 deletions.
Binary file modified .doctrees/apis/components/components.agent.doctree
Binary file not shown.
Binary file modified .doctrees/apis/components/components.agent.react.doctree
Binary file not shown.
Binary file modified .doctrees/apis/components/index.doctree
Binary file not shown.
Binary file modified .doctrees/apis/core/core.func_tool.doctree
Binary file not shown.
Binary file modified .doctrees/apis/core/core.tool_manager.doctree
Binary file not shown.
Binary file modified .doctrees/apis/core/index.doctree
Binary file not shown.
Binary file modified .doctrees/apis/index.doctree
Binary file not shown.
Binary file modified .doctrees/environment.pickle
Binary file not shown.
842 changes: 0 additions & 842 deletions _modules/components/agent/react.html

This file was deleted.

866 changes: 0 additions & 866 deletions _modules/core/func_tool.html

This file was deleted.

746 changes: 0 additions & 746 deletions _modules/core/tool_manager.html

This file was deleted.

5 changes: 1 addition & 4 deletions _modules/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -461,8 +461,7 @@
<article class="bd-article">

<h1>All modules for which code is available</h1>
<ul><li><a href="components/agent/react.html">components.agent.react</a></li>
<li><a href="components/data_process/data_components.html">components.data_process.data_components</a></li>
<ul><li><a href="components/data_process/data_components.html">components.data_process.data_components</a></li>
<li><a href="components/data_process/text_splitter.html">components.data_process.text_splitter</a></li>
<li><a href="components/memory/memory.html">components.memory.memory</a></li>
<li><a href="components/model_client/anthropic_client.html">components.model_client.anthropic_client</a></li>
Expand All @@ -483,7 +482,6 @@ <h1>All modules for which code is available</h1>
<li><a href="core/container.html">core.container</a></li>
<li><a href="core/db.html">core.db</a></li>
<li><a href="core/embedder.html">core.embedder</a></li>
<li><a href="core/func_tool.html">core.func_tool</a></li>
<li><a href="core/functional.html">core.functional</a></li>
<li><a href="core/generator.html">core.generator</a></li>
<li><a href="core/model_client.html">core.model_client</a></li>
Expand All @@ -492,7 +490,6 @@ <h1>All modules for which code is available</h1>
<li><a href="core/retriever.html">core.retriever</a></li>
<li><a href="core/string_parser.html">core.string_parser</a></li>
<li><a href="core/tokenizer.html">core.tokenizer</a></li>
<li><a href="core/tool_manager.html">core.tool_manager</a></li>
<li><a href="core/types.html">core.types</a></li>
<li><a href="eval/answer_match_acc.html">eval.answer_match_acc</a></li>
<li><a href="eval/llm_as_judge.html">eval.llm_as_judge</a></li>
Expand Down
12 changes: 0 additions & 12 deletions _sources/apis/components/components.agent.react.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,3 @@ react
:members:
:undoc-members:
:show-inheritance:


.. rubric:: Classes

.. autosummary::

ReActAgent

.. rubric:: Constants

.. autodata:: components.agent.react.DEFAULT_REACT_AGENT_SYSTEM_PROMPT

14 changes: 0 additions & 14 deletions _sources/apis/core/core.func_tool.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,3 @@ func_tool
:members:
:undoc-members:
:show-inheritance:


.. rubric:: Functions

.. autosummary::

is_running_in_event_loop

.. rubric:: Classes

.. autosummary::

FunctionTool

14 changes: 0 additions & 14 deletions _sources/apis/core/core.tool_manager.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,3 @@ tool_manager
:members:
:undoc-members:
:show-inheritance:


.. rubric:: Functions

.. autosummary::

run_async_in_new_loop

.. rubric:: Classes

.. autosummary::

ToolManager

74 changes: 2 additions & 72 deletions apis/components/components.agent.html
Original file line number Diff line number Diff line change
Expand Up @@ -582,73 +582,10 @@
<h2>Submodules<a class="headerlink" href="#submodules" title="Link to this heading">#</a></h2>
<div class="toctree-wrapper compound">
<ul>
<li class="toctree-l1"><a class="reference internal" href="components.agent.react.html">react</a><ul>
<li class="toctree-l2"><a class="reference internal" href="components.agent.react.html#components.agent.react.DEFAULT_REACT_AGENT_SYSTEM_PROMPT"><code class="docutils literal notranslate"><span class="pre">DEFAULT_REACT_AGENT_SYSTEM_PROMPT</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="components.agent.react.html#components.agent.react.ReActAgent"><code class="docutils literal notranslate"><span class="pre">ReActAgent</span></code></a><ul>
<li class="toctree-l3"><a class="reference internal" href="components.agent.react.html#components.agent.react.ReActAgent.reset"><code class="docutils literal notranslate"><span class="pre">ReActAgent.reset()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="components.agent.react.html#components.agent.react.ReActAgent.call"><code class="docutils literal notranslate"><span class="pre">ReActAgent.call()</span></code></a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="components.agent.react.html">react</a></li>
</ul>
</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="n"><span class="pre">examples</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">FunctionExpression</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="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>, <em class="sig-param"><span class="n"><span class="pre">template</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</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">None</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.
- template: the template to use to generate the prompt. Default is DEFAULT_REACT_AGENT_SYSTEM_PROMPT.</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>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">core.openai_client</span> <span class="kn">import</span> <span class="n">OpenAIClient</span>
<span class="kn">from</span> <span class="nn">components.agent.react</span> <span class="kn">import</span> <span class="n">ReActAgent</span>
<span class="kn">from</span> <span class="nn">core.func_tool</span> <span class="kn">import</span> <span class="n">FunctionTool</span>
<span class="c1"># define the tools</span>
<span class="k">def</span> <span class="nf">multiply</span><span class="p">(</span><span class="n">a</span><span class="p">:</span> <span class="nb">int</span><span class="p">,</span> <span class="n">b</span><span class="p">:</span> <span class="nb">int</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">int</span><span class="p">:</span>
<span class="w"> </span><span class="sd">&#39;&#39;&#39;Multiply two numbers.&#39;&#39;&#39;</span>
<span class="k">return</span> <span class="n">a</span> <span class="o">*</span> <span class="n">b</span>
<span class="k">def</span> <span class="nf">add</span><span class="p">(</span><span class="n">a</span><span class="p">:</span> <span class="nb">int</span><span class="p">,</span> <span class="n">b</span><span class="p">:</span> <span class="nb">int</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">int</span><span class="p">:</span>
<span class="w"> </span><span class="sd">&#39;&#39;&#39;Add two numbers.&#39;&#39;&#39;</span>
<span class="k">return</span> <span class="n">a</span> <span class="o">+</span> <span class="n">b</span>
<span class="n">agent</span> <span class="o">=</span> <span class="n">ReActAgent</span><span class="p">(</span>
<span class="n">tools</span><span class="o">=</span><span class="p">[</span><span class="n">multiply</span><span class="p">,</span> <span class="n">add</span><span class="p">],</span>
<span class="n">model_client</span><span class="o">=</span><span class="n">OpenAIClient</span><span class="p">(),</span>
<span class="n">model_kwargs</span><span class="o">=</span><span class="p">{</span><span class="s2">&quot;model&quot;</span><span class="p">:</span> <span class="s2">&quot;gpt-3.5-turbo&quot;</span><span class="p">},</span>
<span class="p">)</span>

<span class="c1"># Using examples:</span>

<span class="n">call_multiply</span> <span class="o">=</span> <span class="n">FunctionExpression</span><span class="o">.</span><span class="n">from_function</span><span class="p">(</span>
<span class="n">thought</span><span class="o">=</span><span class="s2">&quot;I want to multiply 3 and 4.&quot;</span><span class="p">,</span>
</pre></div>
</div>
<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 @@ -698,14 +635,7 @@ <h2>Submodules<a class="headerlink" href="#submodules" title="Link to this headi
</div>
<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>
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#submodules">Submodules</a></li>
</ul>
</nav></div>

Expand Down
Loading

0 comments on commit 55dc707

Please sign in to comment.