-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add OpenAI-compatible completion model to facade.
- Loading branch information
Showing
2 changed files
with
64 additions
and
5 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
...-provider/openaicompatible/openaicompatible-fireworksai-completion-stream-text-example.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import dotenv from "dotenv"; | ||
import { | ||
FireworksAIApiConfiguration, | ||
openaicompatible, | ||
streamText, | ||
} from "modelfusion"; | ||
|
||
dotenv.config(); | ||
|
||
async function main() { | ||
const textStream = await streamText( | ||
openaicompatible.CompletionTextGenerator({ | ||
api: new FireworksAIApiConfiguration(), | ||
model: "accounts/fireworks/models/mistral-7b", | ||
maxGenerationTokens: 500, | ||
}), | ||
|
||
"Write a story about a robot learning to love" | ||
); | ||
|
||
for await (const textPart of textStream) { | ||
process.stdout.write(textPart); | ||
} | ||
} | ||
|
||
main().catch(console.error); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4d86148
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
modelfusion – ./
modelfusion-lgrammel.vercel.app
modelfusion-git-main-lgrammel.vercel.app
modelfusion.dev
www.modelfusion.dev