added fireworks adapter (#118)

This commit is contained in:
chadbailey59
2024-04-11 17:15:02 -05:00
committed by GitHub
parent f1b6b9f8e5
commit 0b7578056d
3 changed files with 24 additions and 5 deletions

View File

@@ -0,0 +1,18 @@
import os
from dailyai.services.openai_api_llm_service import BaseOpenAILLMService
try:
from openai import AsyncOpenAI
except ModuleNotFoundError as e:
print(f"Exception: {e}")
print(
"In order to use Fireworks, you need to `pip install dailyai[fireworks]`. Also, set the `FIREWORKS_API_KEY` environment variable.")
raise Exception(f"Missing module: {e}")
class FireworksLLMService(BaseOpenAILLMService):
def __init__(self, model="accounts/fireworks/models/firefunction-v1", *args, **kwargs):
kwargs["base_url"] = "https://api.fireworks.ai/inference/v1"
super().__init__(model, *args, **kwargs)