Skip to content

Commit

Permalink
deploy: c7f48ba
Browse files Browse the repository at this point in the history
  • Loading branch information
Blaizzy committed Oct 29, 2024
1 parent 2cb7c63 commit 0c22df6
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 61 deletions.
113 changes: 53 additions & 60 deletions endpoints/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -862,19 +862,19 @@ <h2 id="fastmlx.add_model" class="doc doc-heading">

<details class="quote">
<summary>Source code in <code>fastmlx/fastmlx.py</code></summary>
<div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal">280</span>
<span class="normal">281</span>
<span class="normal">282</span>
<span class="normal">283</span>
<span class="normal">284</span>
<span class="normal">285</span>
<span class="normal">286</span>
<span class="normal">287</span>
<span class="normal">288</span>
<span class="normal">289</span>
<div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal">289</span>
<span class="normal">290</span>
<span class="normal">291</span>
<span class="normal">292</span></pre></div></td><td class="code"><div><pre><span></span><code><span class="nd">@app</span><span class="o">.</span><span class="n">post</span><span class="p">(</span><span class="s2">&quot;/v1/models&quot;</span><span class="p">)</span>
<span class="normal">292</span>
<span class="normal">293</span>
<span class="normal">294</span>
<span class="normal">295</span>
<span class="normal">296</span>
<span class="normal">297</span>
<span class="normal">298</span>
<span class="normal">299</span>
<span class="normal">300</span>
<span class="normal">301</span></pre></div></td><td class="code"><div><pre><span></span><code><span class="nd">@app</span><span class="o">.</span><span class="n">post</span><span class="p">(</span><span class="s2">&quot;/v1/models&quot;</span><span class="p">)</span>
<span class="k">async</span> <span class="k">def</span> <span class="nf">add_model</span><span class="p">(</span><span class="n">model_name</span><span class="p">:</span> <span class="nb">str</span><span class="p">):</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Add a new model to the API.</span>
Expand Down Expand Up @@ -989,8 +989,7 @@ <h2 id="fastmlx.chat_completion" class="doc doc-heading">

<details class="quote">
<summary>Source code in <code>fastmlx/fastmlx.py</code></summary>
<div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal">117</span>
<span class="normal">118</span>
<div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal">118</span>
<span class="normal">119</span>
<span class="normal">120</span>
<span class="normal">121</span>
Expand Down Expand Up @@ -1127,7 +1126,8 @@ <h2 id="fastmlx.chat_completion" class="doc doc-heading">
<span class="normal">252</span>
<span class="normal">253</span>
<span class="normal">254</span>
<span class="normal">255</span></pre></div></td><td class="code"><div><pre><span></span><code><span class="nd">@app</span><span class="o">.</span><span class="n">post</span><span class="p">(</span><span class="s2">&quot;/v1/chat/completions&quot;</span><span class="p">,</span> <span class="n">response_model</span><span class="o">=</span><span class="n">ChatCompletionResponse</span><span class="p">)</span>
<span class="normal">255</span>
<span class="normal">256</span></pre></div></td><td class="code"><div><pre><span></span><code><span class="nd">@app</span><span class="o">.</span><span class="n">post</span><span class="p">(</span><span class="s2">&quot;/v1/chat/completions&quot;</span><span class="p">,</span> <span class="n">response_model</span><span class="o">=</span><span class="n">ChatCompletionResponse</span><span class="p">)</span>
<span class="k">async</span> <span class="k">def</span> <span class="nf">chat_completion</span><span class="p">(</span><span class="n">request</span><span class="p">:</span> <span class="n">ChatCompletionRequest</span><span class="p">):</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Handle chat completion requests for both VLM and LM models.</span>
Expand Down Expand Up @@ -1314,15 +1314,15 @@ <h2 id="fastmlx.get_supported_models" class="doc doc-heading">

<details class="quote">
<summary>Source code in <code>fastmlx/fastmlx.py</code></summary>
<div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal">258</span>
<span class="normal">259</span>
<div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal">259</span>
<span class="normal">260</span>
<span class="normal">261</span>
<span class="normal">262</span>
<span class="normal">263</span>
<span class="normal">264</span>
<span class="normal">265</span>
<span class="normal">266</span></pre></div></td><td class="code"><div><pre><span></span><code><span class="nd">@app</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;/v1/supported_models&quot;</span><span class="p">,</span> <span class="n">response_model</span><span class="o">=</span><span class="n">SupportedModels</span><span class="p">)</span>
<span class="normal">266</span>
<span class="normal">267</span></pre></div></td><td class="code"><div><pre><span></span><code><span class="nd">@app</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;/v1/supported_models&quot;</span><span class="p">,</span> <span class="n">response_model</span><span class="o">=</span><span class="n">SupportedModels</span><span class="p">)</span>
<span class="k">async</span> <span class="k">def</span> <span class="nf">get_supported_models</span><span class="p">():</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Get a list of supported model types for VLM and LM.</span>
Expand Down Expand Up @@ -1352,50 +1352,43 @@ <h2 id="fastmlx.list_models" class="doc doc-heading">

<div class="doc doc-contents ">

<p>List all available (loaded) models.</p>


<p><span class="doc-section-title">Returns:</span></p>
<table>
<thead>
<tr>
<th>Name</th> <th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="doc-section-item">
<td><code>dict</code></td> <td>
<code>dict</code>
</td>
<td>
<div class="doc-md-description">
<p>A dictionary containing the list of available models.</p>
</div>
</td>
</tr>
</tbody>
</table>
<p>Get list of models - provided in OpenAI API compliant format.</p>

<details class="quote">
<summary>Source code in <code>fastmlx/fastmlx.py</code></summary>
<div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal">269</span>
<span class="normal">270</span>
<div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal">270</span>
<span class="normal">271</span>
<span class="normal">272</span>
<span class="normal">273</span>
<span class="normal">274</span>
<span class="normal">275</span>
<span class="normal">276</span>
<span class="normal">277</span></pre></div></td><td class="code"><div><pre><span></span><code><span class="nd">@app</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;/v1/models&quot;</span><span class="p">)</span>
<span class="normal">277</span>
<span class="normal">278</span>
<span class="normal">279</span>
<span class="normal">280</span>
<span class="normal">281</span>
<span class="normal">282</span>
<span class="normal">283</span>
<span class="normal">284</span>
<span class="normal">285</span>
<span class="normal">286</span></pre></div></td><td class="code"><div><pre><span></span><code><span class="nd">@app</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;/v1/models&quot;</span><span class="p">)</span>
<span class="k">async</span> <span class="k">def</span> <span class="nf">list_models</span><span class="p">():</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> List all available (loaded) models.</span>

<span class="sd"> Returns:</span>
<span class="sd"> dict (dict): A dictionary containing the list of available models.</span>
<span class="sd"> Get list of models - provided in OpenAI API compliant format.</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">return</span> <span class="p">{</span><span class="s2">&quot;models&quot;</span><span class="p">:</span> <span class="k">await</span> <span class="n">model_provider</span><span class="o">.</span><span class="n">get_available_models</span><span class="p">()}</span>
<span class="n">models</span> <span class="o">=</span> <span class="k">await</span> <span class="n">model_provider</span><span class="o">.</span><span class="n">get_available_models</span><span class="p">()</span>
<span class="n">models_data</span> <span class="o">=</span> <span class="p">[]</span>
<span class="k">for</span> <span class="n">model</span> <span class="ow">in</span> <span class="n">models</span><span class="p">:</span>
<span class="n">models_data</span><span class="o">.</span><span class="n">append</span><span class="p">(</span>
<span class="p">{</span>
<span class="s2">&quot;id&quot;</span><span class="p">:</span> <span class="n">model</span><span class="p">,</span>
<span class="s2">&quot;object&quot;</span><span class="p">:</span> <span class="s2">&quot;model&quot;</span><span class="p">,</span>
<span class="s2">&quot;created&quot;</span><span class="p">:</span> <span class="nb">int</span><span class="p">(</span><span class="n">time</span><span class="o">.</span><span class="n">time</span><span class="p">()),</span>
<span class="s2">&quot;owned_by&quot;</span><span class="p">:</span> <span class="s2">&quot;system&quot;</span><span class="p">,</span>
<span class="p">}</span>
<span class="p">)</span>
<span class="k">return</span> <span class="p">{</span><span class="s2">&quot;object&quot;</span><span class="p">:</span> <span class="s2">&quot;list&quot;</span><span class="p">,</span> <span class="s2">&quot;data&quot;</span><span class="p">:</span> <span class="n">models_data</span><span class="p">}</span>
</code></pre></div></td></tr></table></div>
</details>
</div>
Expand Down Expand Up @@ -1761,16 +1754,7 @@ <h2 id="fastmlx.remove_model" class="doc doc-heading">

<details class="quote">
<summary>Source code in <code>fastmlx/fastmlx.py</code></summary>
<div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal">295</span>
<span class="normal">296</span>
<span class="normal">297</span>
<span class="normal">298</span>
<span class="normal">299</span>
<span class="normal">300</span>
<span class="normal">301</span>
<span class="normal">302</span>
<span class="normal">303</span>
<span class="normal">304</span>
<div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal">304</span>
<span class="normal">305</span>
<span class="normal">306</span>
<span class="normal">307</span>
Expand All @@ -1780,7 +1764,16 @@ <h2 id="fastmlx.remove_model" class="doc doc-heading">
<span class="normal">311</span>
<span class="normal">312</span>
<span class="normal">313</span>
<span class="normal">314</span></pre></div></td><td class="code"><div><pre><span></span><code><span class="nd">@app</span><span class="o">.</span><span class="n">delete</span><span class="p">(</span><span class="s2">&quot;/v1/models&quot;</span><span class="p">)</span>
<span class="normal">314</span>
<span class="normal">315</span>
<span class="normal">316</span>
<span class="normal">317</span>
<span class="normal">318</span>
<span class="normal">319</span>
<span class="normal">320</span>
<span class="normal">321</span>
<span class="normal">322</span>
<span class="normal">323</span></pre></div></td><td class="code"><div><pre><span></span><code><span class="nd">@app</span><span class="o">.</span><span class="n">delete</span><span class="p">(</span><span class="s2">&quot;/v1/models&quot;</span><span class="p">)</span>
<span class="k">async</span> <span class="k">def</span> <span class="nf">remove_model</span><span class="p">(</span><span class="n">model_name</span><span class="p">:</span> <span class="nb">str</span><span class="p">):</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Remove a model from the API.</span>
Expand Down
Loading

0 comments on commit 0c22df6

Please sign in to comment.