Skip to content

Commit

Permalink
deploy: 98a98c9
Browse files Browse the repository at this point in the history
  • Loading branch information
pan-x-c committed Mar 14, 2024
1 parent 55aeb85 commit 50e5fa6
Show file tree
Hide file tree
Showing 20 changed files with 82 additions and 20 deletions.
Binary file modified en/.doctrees/agentscope.models.doctree
Binary file not shown.
Binary file modified en/.doctrees/environment.pickle
Binary file not shown.
Binary file modified en/.doctrees/index.doctree
Binary file not shown.
19 changes: 14 additions & 5 deletions en/_modules/agentscope/models.html
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,10 @@ <h1>Source code for agentscope.models</h1><div class="highlight"><pre>
<span class="n">OpenAIDALLEWrapper</span><span class="p">,</span>
<span class="n">OpenAIEmbeddingWrapper</span><span class="p">,</span>
<span class="p">)</span>
<span class="kn">from</span> <span class="nn">.tongyi_model</span> <span class="kn">import</span> <span class="p">(</span>
<span class="n">TongyiWrapper</span><span class="p">,</span>
<span class="n">TongyiChatWrapper</span><span class="p">,</span>
<span class="kn">from</span> <span class="nn">.dashscope_model</span> <span class="kn">import</span> <span class="p">(</span>
<span class="n">DashScopeChatWrapper</span><span class="p">,</span>
<span class="n">DashScopeImageSynthesisWrapper</span><span class="p">,</span>
<span class="n">DashScopeTextEmbeddingWrapper</span><span class="p">,</span>
<span class="p">)</span>


Expand All @@ -130,8 +131,9 @@ <h1>Source code for agentscope.models</h1><div class="highlight"><pre>
<span class="s2">&quot;load_model_by_config_name&quot;</span><span class="p">,</span>
<span class="s2">&quot;read_model_configs&quot;</span><span class="p">,</span>
<span class="s2">&quot;clear_model_configs&quot;</span><span class="p">,</span>
<span class="s2">&quot;TongyiWrapper&quot;</span><span class="p">,</span>
<span class="s2">&quot;TongyiChatWrapper&quot;</span><span class="p">,</span>
<span class="s2">&quot;DashScopeChatWrapper&quot;</span><span class="p">,</span>
<span class="s2">&quot;DashScopeImageSynthesisWrapper&quot;</span><span class="p">,</span>
<span class="s2">&quot;DashScopeTextEmbeddingWrapper&quot;</span><span class="p">,</span>
<span class="p">]</span>

<span class="n">_MODEL_CONFIGS</span><span class="p">:</span> <span class="nb">dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="nb">dict</span><span class="p">]</span> <span class="o">=</span> <span class="p">{}</span>
Expand All @@ -154,6 +156,13 @@ <h1>Source code for agentscope.models</h1><div class="highlight"><pre>
<span class="k">return</span> <span class="n">ModelWrapperBase</span><span class="o">.</span><span class="n">registry</span><span class="p">[</span> <span class="c1"># type: ignore [return-value]</span>
<span class="n">model_type</span>
<span class="p">]</span>
<span class="k">elif</span> <span class="n">model_type</span> <span class="ow">in</span> <span class="n">ModelWrapperBase</span><span class="o">.</span><span class="n">deprecated_type_registry</span><span class="p">:</span>
<span class="bp">cls</span> <span class="o">=</span> <span class="n">ModelWrapperBase</span><span class="o">.</span><span class="n">deprecated_type_registry</span><span class="p">[</span><span class="n">model_type</span><span class="p">]</span>
<span class="n">logger</span><span class="o">.</span><span class="n">warning</span><span class="p">(</span>
<span class="sa">f</span><span class="s2">&quot;Model type [</span><span class="si">{</span><span class="n">model_type</span><span class="si">}</span><span class="s2">] will be deprecated in future releases,&quot;</span>
<span class="sa">f</span><span class="s2">&quot; please use [</span><span class="si">{</span><span class="bp">cls</span><span class="o">.</span><span class="n">model_type</span><span class="si">}</span><span class="s2">] instead.&quot;</span><span class="p">,</span>
<span class="p">)</span>
<span class="k">return</span> <span class="bp">cls</span> <span class="c1"># type: ignore [return-value]</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">logger</span><span class="o">.</span><span class="n">warning</span><span class="p">(</span>
<span class="sa">f</span><span class="s2">&quot;Unsupported model_type [</span><span class="si">{</span><span class="n">model_type</span><span class="si">}</span><span class="s2">],&quot;</span>
Expand Down
5 changes: 5 additions & 0 deletions en/_modules/agentscope/models/model.html
Original file line number Diff line number Diff line change
Expand Up @@ -299,10 +299,15 @@ <h1>Source code for agentscope.models.model</h1><div class="highlight"><pre>
<span class="k">if</span> <span class="ow">not</span> <span class="nb">hasattr</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="s2">&quot;registry&quot;</span><span class="p">):</span>
<span class="bp">cls</span><span class="o">.</span><span class="n">registry</span> <span class="o">=</span> <span class="p">{}</span>
<span class="bp">cls</span><span class="o">.</span><span class="n">type_registry</span> <span class="o">=</span> <span class="p">{}</span>
<span class="bp">cls</span><span class="o">.</span><span class="n">deprecated_type_registry</span> <span class="o">=</span> <span class="p">{}</span>
<span class="k">else</span><span class="p">:</span>
<span class="bp">cls</span><span class="o">.</span><span class="n">registry</span><span class="p">[</span><span class="n">name</span><span class="p">]</span> <span class="o">=</span> <span class="bp">cls</span>
<span class="k">if</span> <span class="nb">hasattr</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="s2">&quot;model_type&quot;</span><span class="p">):</span>
<span class="bp">cls</span><span class="o">.</span><span class="n">type_registry</span><span class="p">[</span><span class="bp">cls</span><span class="o">.</span><span class="n">model_type</span><span class="p">]</span> <span class="o">=</span> <span class="bp">cls</span>
<span class="k">if</span> <span class="nb">hasattr</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="s2">&quot;deprecated_model_type&quot;</span><span class="p">):</span>
<span class="bp">cls</span><span class="o">.</span><span class="n">deprecated_type_registry</span><span class="p">[</span>
<span class="bp">cls</span><span class="o">.</span><span class="n">deprecated_model_type</span>
<span class="p">]</span> <span class="o">=</span> <span class="bp">cls</span>
<span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="fm">__init__</span><span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="n">bases</span><span class="p">,</span> <span class="n">attrs</span><span class="p">)</span>


Expand Down
9 changes: 9 additions & 0 deletions en/_modules/agentscope/models/openai_model.html
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,9 @@ <h1>Source code for agentscope.models.openai_model</h1><div class="highlight"><p
<span class="o">**</span><span class="n">kwargs</span><span class="p">,</span>
<span class="p">)</span>

<span class="k">if</span> <span class="n">response</span><span class="o">.</span><span class="n">status_code</span> <span class="o">!=</span> <span class="mi">200</span><span class="p">:</span>
<span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">(</span><span class="n">response</span><span class="o">.</span><span class="n">json</span><span class="p">())</span>

<span class="c1"># step4: record the api invocation if needed</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_save_model_invocation</span><span class="p">(</span>
<span class="n">arguments</span><span class="o">=</span><span class="p">{</span>
Expand Down Expand Up @@ -413,6 +416,9 @@ <h1>Source code for agentscope.models.openai_model</h1><div class="highlight"><p
<span class="p">)</span>
<span class="k">raise</span> <span class="n">e</span>

<span class="k">if</span> <span class="n">response</span><span class="o">.</span><span class="n">status_code</span> <span class="o">!=</span> <span class="mi">200</span><span class="p">:</span>
<span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">(</span><span class="n">response</span><span class="o">.</span><span class="n">json</span><span class="p">())</span>

<span class="c1"># step3: record the model api invocation if needed</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_save_model_invocation</span><span class="p">(</span>
<span class="n">arguments</span><span class="o">=</span><span class="p">{</span>
Expand Down Expand Up @@ -500,6 +506,9 @@ <h1>Source code for agentscope.models.openai_model</h1><div class="highlight"><p
<span class="o">**</span><span class="n">kwargs</span><span class="p">,</span>
<span class="p">)</span>

<span class="k">if</span> <span class="n">response</span><span class="o">.</span><span class="n">status_code</span> <span class="o">!=</span> <span class="mi">200</span><span class="p">:</span>
<span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">(</span><span class="n">response</span><span class="o">.</span><span class="n">json</span><span class="p">())</span>

<span class="c1"># step3: record the model api invocation if needed</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_save_model_invocation</span><span class="p">(</span>
<span class="n">arguments</span><span class="o">=</span><span class="p">{</span>
Expand Down
10 changes: 8 additions & 2 deletions en/agentscope.models.html
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="#agentscope.models.model.ModelWrapperBase"><code class="docutils literal notranslate"><span class="pre">ModelWrapperBase</span></code></a><ul>
<li class="toctree-l4"><a class="reference internal" href="#agentscope.models.model.ModelWrapperBase.deprecated_type_registry"><code class="docutils literal notranslate"><span class="pre">ModelWrapperBase.deprecated_type_registry</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="#agentscope.models.model.ModelWrapperBase.registry"><code class="docutils literal notranslate"><span class="pre">ModelWrapperBase.registry</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="#agentscope.models.model.ModelWrapperBase.type_registry"><code class="docutils literal notranslate"><span class="pre">ModelWrapperBase.type_registry</span></code></a></li>
</ul>
Expand Down Expand Up @@ -275,14 +276,19 @@ <h1>Models package<a class="headerlink" href="#models-package" title="Link to th
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">agentscope.models.model.</span></span><span class="sig-name descname"><span class="pre">ModelWrapperBase</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">config_name</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="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Any</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/agentscope/models/model.html#ModelWrapperBase"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#agentscope.models.model.ModelWrapperBase" title="Link to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<p>The base class for model wrapper.</p>
<dl class="py attribute">
<dt class="sig sig-object py" id="agentscope.models.model.ModelWrapperBase.deprecated_type_registry">
<span class="sig-name descname"><span class="pre">deprecated_type_registry</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">{'tongyi_chat':</span> <span class="pre">&lt;class</span> <span class="pre">'agentscope.models.dashscope_model.DashScopeChatWrapper'&gt;}</span></em><a class="headerlink" href="#agentscope.models.model.ModelWrapperBase.deprecated_type_registry" title="Link to this definition"></a></dt>
<dd></dd></dl>

<dl class="py attribute">
<dt class="sig sig-object py" id="agentscope.models.model.ModelWrapperBase.registry">
<span class="sig-name descname"><span class="pre">registry</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">{'OpenAIChatWrapper':</span> <span class="pre">&lt;class</span> <span class="pre">'agentscope.models.openai_model.OpenAIChatWrapper'&gt;,</span> <span class="pre">'OpenAIDALLEWrapper':</span> <span class="pre">&lt;class</span> <span class="pre">'agentscope.models.openai_model.OpenAIDALLEWrapper'&gt;,</span> <span class="pre">'OpenAIEmbeddingWrapper':</span> <span class="pre">&lt;class</span> <span class="pre">'agentscope.models.openai_model.OpenAIEmbeddingWrapper'&gt;,</span> <span class="pre">'OpenAIWrapper':</span> <span class="pre">&lt;class</span> <span class="pre">'agentscope.models.openai_model.OpenAIWrapper'&gt;,</span> <span class="pre">'PostAPIChatWrapper':</span> <span class="pre">&lt;class</span> <span class="pre">'agentscope.models.post_model.PostAPIChatWrapper'&gt;,</span> <span class="pre">'PostAPIDALLEWrapper':</span> <span class="pre">&lt;class</span> <span class="pre">'agentscope.models.post_model.PostAPIDALLEWrapper'&gt;,</span> <span class="pre">'PostAPIModelWrapperBase':</span> <span class="pre">&lt;class</span> <span class="pre">'agentscope.models.post_model.PostAPIModelWrapperBase'&gt;,</span> <span class="pre">'TongyiChatWrapper':</span> <span class="pre">&lt;class</span> <span class="pre">'agentscope.models.tongyi_model.TongyiChatWrapper'&gt;,</span> <span class="pre">'TongyiWrapper':</span> <span class="pre">&lt;class</span> <span class="pre">'agentscope.models.tongyi_model.TongyiWrapper'&gt;}</span></em><a class="headerlink" href="#agentscope.models.model.ModelWrapperBase.registry" title="Link to this definition"></a></dt>
<span class="sig-name descname"><span class="pre">registry</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">{'DashScopeChatWrapper':</span> <span class="pre">&lt;class</span> <span class="pre">'agentscope.models.dashscope_model.DashScopeChatWrapper'&gt;,</span> <span class="pre">'DashScopeImageSynthesisWrapper':</span> <span class="pre">&lt;class</span> <span class="pre">'agentscope.models.dashscope_model.DashScopeImageSynthesisWrapper'&gt;,</span> <span class="pre">'DashScopeTextEmbeddingWrapper':</span> <span class="pre">&lt;class</span> <span class="pre">'agentscope.models.dashscope_model.DashScopeTextEmbeddingWrapper'&gt;,</span> <span class="pre">'DashScopeWrapper':</span> <span class="pre">&lt;class</span> <span class="pre">'agentscope.models.dashscope_model.DashScopeWrapper'&gt;,</span> <span class="pre">'OpenAIChatWrapper':</span> <span class="pre">&lt;class</span> <span class="pre">'agentscope.models.openai_model.OpenAIChatWrapper'&gt;,</span> <span class="pre">'OpenAIDALLEWrapper':</span> <span class="pre">&lt;class</span> <span class="pre">'agentscope.models.openai_model.OpenAIDALLEWrapper'&gt;,</span> <span class="pre">'OpenAIEmbeddingWrapper':</span> <span class="pre">&lt;class</span> <span class="pre">'agentscope.models.openai_model.OpenAIEmbeddingWrapper'&gt;,</span> <span class="pre">'OpenAIWrapper':</span> <span class="pre">&lt;class</span> <span class="pre">'agentscope.models.openai_model.OpenAIWrapper'&gt;,</span> <span class="pre">'PostAPIChatWrapper':</span> <span class="pre">&lt;class</span> <span class="pre">'agentscope.models.post_model.PostAPIChatWrapper'&gt;,</span> <span class="pre">'PostAPIDALLEWrapper':</span> <span class="pre">&lt;class</span> <span class="pre">'agentscope.models.post_model.PostAPIDALLEWrapper'&gt;,</span> <span class="pre">'PostAPIModelWrapperBase':</span> <span class="pre">&lt;class</span> <span class="pre">'agentscope.models.post_model.PostAPIModelWrapperBase'&gt;}</span></em><a class="headerlink" href="#agentscope.models.model.ModelWrapperBase.registry" title="Link to this definition"></a></dt>
<dd></dd></dl>

<dl class="py attribute">
<dt class="sig sig-object py" id="agentscope.models.model.ModelWrapperBase.type_registry">
<span class="sig-name descname"><span class="pre">type_registry</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">{'openai':</span> <span class="pre">&lt;class</span> <span class="pre">'agentscope.models.openai_model.OpenAIChatWrapper'&gt;,</span> <span class="pre">'openai_dall_e':</span> <span class="pre">&lt;class</span> <span class="pre">'agentscope.models.openai_model.OpenAIDALLEWrapper'&gt;,</span> <span class="pre">'openai_embedding':</span> <span class="pre">&lt;class</span> <span class="pre">'agentscope.models.openai_model.OpenAIEmbeddingWrapper'&gt;,</span> <span class="pre">'post_api':</span> <span class="pre">&lt;class</span> <span class="pre">'agentscope.models.post_model.PostAPIModelWrapperBase'&gt;,</span> <span class="pre">'post_api_chat':</span> <span class="pre">&lt;class</span> <span class="pre">'agentscope.models.post_model.PostAPIChatWrapper'&gt;,</span> <span class="pre">'post_api_dalle':</span> <span class="pre">&lt;class</span> <span class="pre">'agentscope.models.post_model.PostAPIDALLEWrapper'&gt;,</span> <span class="pre">'tongyi_chat':</span> <span class="pre">&lt;class</span> <span class="pre">'agentscope.models.tongyi_model.TongyiChatWrapper'&gt;}</span></em><a class="headerlink" href="#agentscope.models.model.ModelWrapperBase.type_registry" title="Link to this definition"></a></dt>
<span class="sig-name descname"><span class="pre">type_registry</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">{'dashscope_chat':</span> <span class="pre">&lt;class</span> <span class="pre">'agentscope.models.dashscope_model.DashScopeChatWrapper'&gt;,</span> <span class="pre">'dashscope_image_synthesis':</span> <span class="pre">&lt;class</span> <span class="pre">'agentscope.models.dashscope_model.DashScopeImageSynthesisWrapper'&gt;,</span> <span class="pre">'dashscope_text_embedding':</span> <span class="pre">&lt;class</span> <span class="pre">'agentscope.models.dashscope_model.DashScopeTextEmbeddingWrapper'&gt;,</span> <span class="pre">'openai':</span> <span class="pre">&lt;class</span> <span class="pre">'agentscope.models.openai_model.OpenAIChatWrapper'&gt;,</span> <span class="pre">'openai_dall_e':</span> <span class="pre">&lt;class</span> <span class="pre">'agentscope.models.openai_model.OpenAIDALLEWrapper'&gt;,</span> <span class="pre">'openai_embedding':</span> <span class="pre">&lt;class</span> <span class="pre">'agentscope.models.openai_model.OpenAIEmbeddingWrapper'&gt;,</span> <span class="pre">'post_api':</span> <span class="pre">&lt;class</span> <span class="pre">'agentscope.models.post_model.PostAPIModelWrapperBase'&gt;,</span> <span class="pre">'post_api_chat':</span> <span class="pre">&lt;class</span> <span class="pre">'agentscope.models.post_model.PostAPIChatWrapper'&gt;,</span> <span class="pre">'post_api_dalle':</span> <span class="pre">&lt;class</span> <span class="pre">'agentscope.models.post_model.PostAPIDALLEWrapper'&gt;}</span></em><a class="headerlink" href="#agentscope.models.model.ModelWrapperBase.type_registry" title="Link to this definition"></a></dt>
<dd></dd></dl>

</dd></dl>
Expand Down
Loading

0 comments on commit 50e5fa6

Please sign in to comment.