Skip to content

Commit 441478b

Browse files
committed
Add support for fireworks AI
1 parent 1cbae90 commit 441478b

File tree

4 files changed

+28
-1
lines changed

4 files changed

+28
-1
lines changed

llms/extensions/providers/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from .anthropic import install_anthropic
22
from .cerebras import install_cerebras
33
from .chutes import install_chutes
4+
from .fireworks import install_fireworks
45
from .google import install_google
56
from .mistral import install_mistral
67
from .nvidia import install_nvidia
@@ -13,6 +14,7 @@ def install(ctx):
1314
install_anthropic(ctx)
1415
install_cerebras(ctx)
1516
install_chutes(ctx)
17+
install_fireworks(ctx)
1618
install_google(ctx)
1719
install_mistral(ctx)
1820
install_nvidia(ctx)
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
def install_fireworks(ctx):
2+
from llms.main import OpenAiCompatible
3+
4+
class FireworksProvider(OpenAiCompatible):
5+
sdk = "@fireworks/ai-sdk-provider"
6+
7+
def __init__(self, **kwargs):
8+
super().__init__(**kwargs)
9+
10+
async def process_chat(self, chat, provider_id=None):
11+
ret = await super().process_chat(chat, provider_id)
12+
chat.pop("modalities", None)
13+
chat.pop("enable_thinking", None)
14+
messages = chat.get("messages", []).copy()
15+
for message in messages:
16+
# fireworks doesn't support timestamp, reasoning, refusal
17+
message.pop("timestamp", None)
18+
message.pop("reasoning", None)
19+
message.pop("refusal", None)
20+
ret["messages"] = messages
21+
return ret
22+
23+
ctx.add_provider(FireworksProvider)

llms/llms.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,8 @@
427427
"enabled": true
428428
},
429429
"fireworks-ai": {
430-
"enabled": true
430+
"enabled": true,
431+
"npm": "@fireworks/ai-sdk-provider"
431432
},
432433
"openrouter": {
433434
"enabled": true,

llms/ui/modules/icons.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ const ProviderIcon = {
1717
<svg v-else-if="matches(['deepseek'])" fill="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M23.748 4.482c-.254-.124-.364.113-.512.234-.051.039-.094.09-.137.136-.372.397-.806.657-1.373.626-.829-.046-1.537.214-2.163.848-.133-.782-.575-1.248-1.247-1.548-.352-.156-.708-.311-.955-.65-.172-.241-.219-.51-.305-.774-.055-.16-.11-.323-.293-.35-.2-.031-.278.136-.356.276-.313.572-.434 1.202-.422 1.84.027 1.436.633 2.58 1.838 3.393.137.093.172.187.129.323-.082.28-.18.552-.266.833-.055.179-.137.217-.329.14a5.526 5.526 0 01-1.736-1.18c-.857-.828-1.631-1.742-2.597-2.458a11.365 11.365 0 00-.689-.471c-.985-.957.13-1.743.388-1.836.27-.098.093-.432-.779-.428-.872.004-1.67.295-2.687.684a3.055 3.055 0 01-.465.137 9.597 9.597 0 00-2.883-.102c-1.885.21-3.39 1.102-4.497 2.623C.082 8.606-.231 10.684.152 12.85c.403 2.284 1.569 4.175 3.36 5.653 1.858 1.533 3.997 2.284 6.438 2.14 1.482-.085 3.133-.284 4.994-1.86.47.234.962.327 1.78.397.63.059 1.236-.03 1.705-.128.735-.156.684-.837.419-.961-2.155-1.004-1.682-.595-2.113-.926 1.096-1.296 2.746-2.642 3.392-7.003.05-.347.007-.565 0-.845-.004-.17.035-.237.23-.256a4.173 4.173 0 001.545-.475c1.396-.763 1.96-2.015 2.093-3.517.02-.23-.004-.467-.247-.588zM11.581 18c-2.089-1.642-3.102-2.183-3.52-2.16-.392.024-.321.471-.235.763.09.288.207.486.371.739.114.167.192.416-.113.603-.673.416-1.842-.14-1.897-.167-1.361-.802-2.5-1.86-3.301-3.307-.774-1.393-1.224-2.887-1.298-4.482-.02-.386.093-.522.477-.592a4.696 4.696 0 011.529-.039c2.132.312 3.946 1.265 5.468 2.774.868.86 1.525 1.887 2.202 2.891.72 1.066 1.494 2.082 2.48 2.914.348.292.625.514.891.677-.802.09-2.14.11-3.054-.614zm1-6.44a.306.306 0 01.415-.287.302.302 0 01.2.288.306.306 0 01-.31.307.303.303 0 01-.304-.308zm3.11 1.596c-.2.081-.399.151-.59.16a1.245 1.245 0 01-.798-.254c-.274-.23-.47-.358-.552-.758a1.73 1.73 0 01.016-.588c.07-.327-.008-.537-.239-.727-.187-.156-.426-.199-.688-.199a.559.559 0 01-.254-.078c-.11-.054-.2-.19-.114-.358.028-.054.16-.186.192-.21.356-.202.767-.136 1.146.016.352.144.618.408 1.001.782.391.451.462.576.685.914.176.265.336.537.445.848.067.195-.019.354-.25.452z"></path></svg>
1818
<svg v-else-if="matches(['nvidia'])" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="currentColor" transform="translate(0,4)" d="M9.01,4.79L9.01,3.35C9.14,3.34 9.28,3.33 9.43,3.33C13.38,3.2 15.97,6.72 15.97,6.72C15.97,6.72 13.17,10.6 10.17,10.6C9.77,10.6 9.38,10.54 9.01,10.41L9.01,6.03C10.54,6.23 10.85,6.9 11.77,8.44L13.83,6.71C13.83,6.71 12.32,4.75 9.8,4.75C9.52,4.75 9.26,4.76 9.01,4.79ZM9.01,0.025L9.01,2.18C9.14,2.17 9.28,2.16 9.43,2.15C14.91,1.97 18.5,6.65 18.5,6.65C18.5,6.65 14.38,11.64 10.11,11.64C9.71,11.64 9.35,11.61 9.01,11.54L9.01,12.88C9.3,12.91 9.6,12.93 9.93,12.93C13.9,12.93 16.78,10.91 19.57,8.5C20.03,8.87 21.91,9.77 22.3,10.17C19.66,12.38 13.48,14.17 9.99,14.17C9.66,14.17 9.33,14.15 9.01,14.12L9.01,16L24.12,16L24.12,0.025L9.01,0.025ZM9.01,10.41L9.01,11.54C5.32,10.89 4.3,7.06 4.3,7.06C4.3,7.06 6.07,5.1 9.01,4.79L9.01,6.03L9,6.03C7.46,5.85 6.25,7.29 6.25,7.29C6.25,7.29 6.93,9.71 9.01,10.41ZM2.47,6.9C2.47,6.9 4.65,3.68 9.01,3.35L9.01,2.18C4.18,2.57 0,6.65 0,6.65C0,6.65 2.37,13.5 9.01,14.11L9.01,12.88C4.13,12.26 2.47,6.9 2.47,6.9Z"/></svg>
1919
<svg v-else-if="matches(['lmstudio'])" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path shape-rendering="geometricPrecision" d="M9.8132 15.9038L9 18.75L8.1868 15.9038C7.75968 14.4089 6.59112 13.2403 5.09619 12.8132L2.25 12L5.09619 11.1868C6.59113 10.7597 7.75968 9.59112 8.1868 8.09619L9 5.25L9.8132 8.09619C10.2403 9.59113 11.4089 10.7597 12.9038 11.1868L15.75 12L12.9038 12.8132C11.4089 13.2403 10.2403 14.4089 9.8132 15.9038Z" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" /><path d="M18.2589 8.71454L18 9.75L17.7411 8.71454C17.4388 7.50533 16.4947 6.56117 15.2855 6.25887L14.25 6L15.2855 5.74113C16.4947 5.43883 17.4388 4.49467 17.7411 3.28546L18 2.25L18.2589 3.28546C18.5612 4.49467 19.5053 5.43883 20.7145 5.74113L21.75 6L20.7145 6.25887C19.5053 6.56117 18.5612 7.50533 18.2589 8.71454Z" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" /><path d="M16.8942 20.5673L16.5 21.75L16.1058 20.5673C15.8818 19.8954 15.3546 19.3682 14.6827 19.1442L13.5 18.75L14.6827 18.3558C15.3546 18.1318 15.8818 17.6046 16.1058 16.9327L16.5 15.75L16.8942 16.9327C17.1182 17.6046 17.6454 18.1318 18.3173 18.3558L19.5 18.75L18.3173 19.1442C17.6454 19.3682 17.1182 19.8954 16.8942 20.5673Z" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" /></svg>
20+
<svg v-else-if="matches(['fireworks'])" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path shape-rendering="geometricPrecision" d="M9.8132 15.9038L9 18.75L8.1868 15.9038C7.75968 14.4089 6.59112 13.2403 5.09619 12.8132L2.25 12L5.09619 11.1868C6.59113 10.7597 7.75968 9.59112 8.1868 8.09619L9 5.25L9.8132 8.09619C10.2403 9.59113 11.4089 10.7597 12.9038 11.1868L15.75 12L12.9038 12.8132C11.4089 13.2403 10.2403 14.4089 9.8132 15.9038Z" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" /><path d="M18.2589 8.71454L18 9.75L17.7411 8.71454C17.4388 7.50533 16.4947 6.56117 15.2855 6.25887L14.25 6L15.2855 5.74113C16.4947 5.43883 17.4388 4.49467 17.7411 3.28546L18 2.25L18.2589 3.28546C18.5612 4.49467 19.5053 5.43883 20.7145 5.74113L21.75 6L20.7145 6.25887C19.5053 6.56117 18.5612 7.50533 18.2589 8.71454Z" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" /><path d="M16.8942 20.5673L16.5 21.75L16.1058 20.5673C15.8818 19.8954 15.3546 19.3682 14.6827 19.1442L13.5 18.75L14.6827 18.3558C15.3546 18.1318 15.8818 17.6046 16.1058 16.9327L16.5 15.75L16.8942 16.9327C17.1182 17.6046 17.6454 18.1318 18.3173 18.3558L19.5 18.75L18.3173 19.1442C17.6454 19.3682 17.1182 19.8954 16.8942 20.5673Z" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" /></svg>
2021
<svg v-else-if="matches(['cerebras'])" viewBox="0 0 40 40" xmlns="http://www.w3.org/2000/svg"><path d="M22.9846 6.52999C19.4122 6.52999 15.9861 7.94913 13.46 10.4752C10.9339 13.0013 9.51474 16.4274 9.51474 19.9999C9.51474 23.5723 10.9339 26.9984 13.46 29.5245C15.9861 32.0506 19.4122 33.4698 22.9846 33.4698V35.4991C14.4238 35.4991 7.48535 28.5592 7.48535 19.9984C7.48535 11.4376 14.4224 4.49915 22.9832 4.49915V6.52854L22.9846 6.52999ZM29.868 11.8562C28.7978 10.9477 27.5586 10.2598 26.2216 9.83189C24.8846 9.40401 23.4761 9.24465 22.0773 9.36298C20.6785 9.48132 19.3169 9.875 18.0707 10.5214C16.8246 11.1678 15.7185 12.0542 14.8162 13.1295C13.9138 14.2049 13.2329 15.448 12.8126 16.7875C12.3923 18.1269 12.241 19.5362 12.3673 20.9343C12.4936 22.3324 12.895 23.6918 13.5485 24.9342C14.202 26.1767 15.0946 27.2777 16.1751 28.1739L14.87 29.7296C13.594 28.6594 12.5414 27.3482 11.7722 25.871C11.003 24.3939 10.5323 22.7797 10.3871 21.1206C10.2418 19.4615 10.4247 17.7901 10.9255 16.2017C11.4263 14.6134 12.235 13.1392 13.3055 11.8635C14.376 10.5875 15.6873 9.5348 17.1645 8.7656C18.6418 7.99639 20.2561 7.52572 21.9153 7.38045C23.5745 7.23517 25.2461 7.41815 26.8345 7.91893C28.423 8.41971 29.8973 9.22848 31.1732 10.2991L29.868 11.8562ZM26.6016 13.0788C24.7668 12.1311 22.6319 11.9464 20.6616 12.5649C18.6913 13.1834 17.045 14.5551 16.0809 16.3813C15.1169 18.2076 14.9132 20.3408 15.514 22.3165C16.1149 24.2923 17.4718 25.9508 19.2894 26.9311L18.3392 28.7273C16.0689 27.4824 14.3791 25.3948 13.6343 22.915C12.8896 20.4352 13.1498 17.762 14.3586 15.4723C15.5674 13.1826 17.628 11.46 20.0957 10.6762C22.5635 9.89232 25.2404 10.1101 27.5489 11.2826L26.6016 13.0788ZM22.9832 14.9865C21.6536 14.9865 20.3784 15.5147 19.4382 16.4549C18.498 17.3951 17.9698 18.6702 17.9698 19.9999C17.9698 21.3295 18.498 22.6047 19.4382 23.5449C20.3784 24.485 21.6536 25.0132 22.9832 25.0132V27.0441C21.1149 27.0441 19.3232 26.3019 18.0022 24.9809C16.6811 23.6598 15.939 21.8681 15.939 19.9999C15.939 18.1316 16.6811 16.3399 18.0022 15.0189C19.3232 13.6978 21.1149 12.9557 22.9832 12.9557V14.9865Z" fill="currentColor"/><path d="M24.8474 18.3138C24.6315 18.0812 24.3826 17.8816 24.1087 17.7213C23.8701 17.5796 23.5982 17.5036 23.3207 17.5011C22.9513 17.5011 22.621 17.5692 22.3299 17.7039C22.0485 17.8307 21.7956 18.0131 21.5865 18.2401C21.3774 18.4672 21.2164 18.7341 21.1131 19.025C21.0059 19.319 20.9538 19.6276 20.9538 19.939C20.9538 20.2548 21.0059 20.5619 21.1131 20.853C21.2172 21.1436 21.3786 21.4104 21.5876 21.6375C21.7966 21.8647 22.049 22.0476 22.3299 22.1756C22.6196 22.3103 22.9528 22.3783 23.3207 22.3783C23.6336 22.3783 23.9247 22.3117 24.1927 22.1828C24.465 22.0524 24.6997 21.8569 24.8808 21.615L26.225 23.0722C26.0222 23.275 25.7904 23.4503 25.5268 23.598C25.0392 23.8699 24.5086 24.0561 23.958 24.1484C23.7118 24.1861 23.4989 24.2064 23.3207 24.2064C22.7362 24.21 22.156 24.107 21.6085 23.9022C21.0909 23.7108 20.6174 23.4166 20.2165 23.0374C19.8178 22.6565 19.5004 22.1987 19.2836 21.6917C19.0481 21.1378 18.9306 20.5409 18.9389 19.939C18.9389 19.2959 19.0548 18.7121 19.2836 18.1863C19.5009 17.6793 19.8167 17.2216 20.215 16.8406C20.6177 16.4625 21.0914 16.1685 21.6085 15.9773C22.156 15.7725 22.7362 15.6694 23.3207 15.6731C23.8349 15.6731 24.352 15.7716 24.8735 15.9686C25.3964 16.1685 25.8658 16.4901 26.2409 16.9087L24.8474 18.3138Z" fill="currentColor"/></svg>
2122
<svg v-else-if="matches(['huggingface'])" fill="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M16.781 3.277c2.997 1.704 4.844 4.851 4.844 8.258 0 .995-.155 1.955-.443 2.857a1.332 1.332 0 011.125.4 1.41 1.41 0 01.2 1.723c.204.165.352.385.428.632l.017.062c.06.222.12.69-.2 1.166.244.37.279.836.093 1.236-.255.57-.893 1.018-2.128 1.5l-.202.078-.131.048c-.478.173-.89.295-1.061.345l-.086.024c-.89.243-1.808.375-2.732.394-1.32 0-2.3-.36-2.923-1.067a9.852 9.852 0 01-3.18.018C9.778 21.647 8.802 22 7.494 22a11.249 11.249 0 01-2.541-.343l-.221-.06-.273-.08a16.574 16.574 0 01-1.175-.405c-1.237-.483-1.875-.93-2.13-1.501-.186-.4-.151-.867.093-1.236a1.42 1.42 0 01-.2-1.166c.069-.273.226-.516.447-.694a1.41 1.41 0 01.2-1.722c.233-.248.557-.391.917-.407l.078-.001a9.385 9.385 0 01-.44-2.85c0-3.407 1.847-6.554 4.844-8.258a9.822 9.822 0 019.687 0zM4.188 14.758c.125.687 2.357 2.35 2.14 2.707-.19.315-.796-.239-.948-.386l-.041-.04-.168-.147c-.561-.479-2.304-1.9-2.74-1.432-.43.46.119.859 1.055 1.42l.784.467.136.083c1.045.643 1.12.84.95 1.113-.188.295-3.07-2.1-3.34-1.083-.27 1.011 2.942 1.304 2.744 2.006-.2.7-2.265-1.324-2.685-.537-.425.79 2.913 1.718 2.94 1.725l.16.04.175.042c1.227.284 3.565.65 4.435-.604.673-.973.64-1.709-.248-2.61l-.057-.057c-.945-.928-1.495-2.288-1.495-2.288l-.017-.058-.025-.072c-.082-.22-.284-.639-.63-.584-.46.073-.798 1.21.12 1.933l.05.038c.977.721-.195 1.21-.573.534l-.058-.104-.143-.25c-.463-.799-1.282-2.111-1.739-2.397-.532-.332-.907-.148-.782.541zm14.842-.541c-.533.335-1.563 2.074-1.94 2.751a.613.613 0 01-.687.302.436.436 0 01-.176-.098.303.303 0 01-.049-.06l-.014-.028-.008-.02-.007-.019-.003-.013-.003-.017a.289.289 0 01-.004-.048c0-.12.071-.266.25-.427.026-.024.054-.047.084-.07l.047-.036c.022-.016.043-.032.063-.049.883-.71.573-1.81.131-1.917l-.031-.006-.056-.004a.368.368 0 00-.062.006l-.028.005-.042.014-.039.017-.028.015-.028.019-.036.027-.023.02c-.173.158-.273.428-.31.542l-.016.054s-.53 1.309-1.439 2.234l-.054.054c-.365.358-.596.69-.702 1.018-.143.437-.066.868.21 1.353.055.097.117.195.187.296.882 1.275 3.282.876 4.494.59l.286-.07.25-.074c.276-.084.736-.233 1.2-.42l.188-.077.065-.028.064-.028.124-.056.081-.038c.529-.252.964-.543.994-.827l.001-.036a.299.299 0 00-.037-.139c-.094-.176-.271-.212-.491-.168l-.045.01c-.044.01-.09.024-.136.04l-.097.035-.054.022c-.559.23-1.238.705-1.607.745h.006a.452.452 0 01-.05.003h-.024l-.024-.003-.023-.005c-.068-.016-.116-.06-.14-.142a.22.22 0 01-.005-.1c.062-.345.958-.595 1.713-.91l.066-.028c.528-.224.97-.483.985-.832v-.04a.47.47 0 00-.016-.098c-.048-.18-.175-.251-.36-.251-.785 0-2.55 1.36-2.92 1.36-.025 0-.048-.007-.058-.024a.6.6 0 01-.046-.088c-.1-.238.068-.462 1.06-1.066l.209-.126c.538-.32 1.01-.588 1.341-.831.29-.212.475-.406.503-.6l.003-.028c.008-.113-.038-.227-.147-.344a.266.266 0 00-.07-.054l-.034-.015-.013-.005a.403.403 0 00-.13-.02c-.162 0-.369.07-.595.18-.637.313-1.431.952-1.826 1.285l-.249.215-.033.033c-.08.078-.288.27-.493.386l-.071.037-.041.019a.535.535 0 01-.122.036h.005a.346.346 0 01-.031.003l.01-.001-.013.001c-.079.005-.145-.021-.19-.095a.113.113 0 01-.014-.065c.027-.465 2.034-1.991 2.152-2.642l.009-.048c.1-.65-.271-.817-.791-.493zM11.938 2.984c-4.798 0-8.688 3.829-8.688 8.55 0 .692.083 1.364.24 2.008l.008-.009c.252-.298.612-.46 1.017-.46.355.008.699.117.993.312.22.14.465.384.715.694.261-.372.69-.598 1.15-.605.852 0 1.367.728 1.562 1.383l.047.105.06.127c.192.396.595 1.139 1.143 1.68 1.06 1.04 1.324 2.115.8 3.266a8.865 8.865 0 002.024-.014c-.505-1.12-.26-2.17.74-3.186l.066-.066c.695-.684 1.157-1.69 1.252-1.912.195-.655.708-1.383 1.56-1.383.46.007.889.233 1.15.605.25-.31.495-.553.718-.694a1.87 1.87 0 01.99-.312c.357 0 .682.126.925.36.14-.61.215-1.245.215-1.898 0-4.722-3.89-8.55-8.687-8.55zm1.857 8.926l.439-.212c.553-.264.89-.383.89.152 0 1.093-.771 3.208-3.155 3.262h-.184c-2.325-.052-3.116-2.06-3.156-3.175l-.001-.087c0-1.107 1.452.586 3.25.586.716 0 1.379-.272 1.917-.526zm4.017-3.143c.45 0 .813.358.813.8 0 .441-.364.8-.813.8a.806.806 0 01-.812-.8c0-.442.364-.8.812-.8zm-11.624 0c.448 0 .812.358.812.8 0 .441-.364.8-.812.8a.806.806 0 01-.813-.8c0-.442.364-.8.813-.8zm7.79-.841c.32-.384.846-.54 1.33-.394.483.146.83.564.878 1.06.048.495-.212.97-.659 1.203-.322.168-.447-.477-.767-.585l.002-.003c-.287-.098-.772.362-.925.079a1.215 1.215 0 01.14-1.36zm-4.323 0c.322.384.377.92.14 1.36-.152.283-.64-.177-.925-.079l.003.003c-.108.036-.194.134-.273.24l-.118.165c-.11.15-.22.262-.377.18a1.226 1.226 0 01-.658-1.204c.048-.495.395-.913.878-1.059a1.262 1.262 0 011.33.394z"></path></svg>
2223
<svg v-else-if="matches(['servicestack'])" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M96 216c81.7 10.2 273.7 102.3 304 232H8c99.5-8.1 184.5-137 88-232m32-152c32.3 35.6 47.7 83.9 46.4 133.6C257.3 231.3 381.7 321.3 408 448h96C463.3 231.9 230.8 79.5 128 64"/></svg>

0 commit comments

Comments
 (0)