Skip to content

Commit

Permalink
feat (providers/fireworks): add qwq-32b model (#5080)
Browse files Browse the repository at this point in the history
  • Loading branch information
shaper authored Mar 6, 2025
1 parent e1a2cb8 commit 9dcc12d
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/quick-meals-know.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@ai-sdk/fireworks': patch
---

feat (providers/fireworks): add qwq-32b model
31 changes: 31 additions & 0 deletions examples/ai-core/src/generate-text/fireworks-reasoning.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { fireworks } from '@ai-sdk/fireworks';
import {
extractReasoningMiddleware,
generateText,
wrapLanguageModel,
} from 'ai';
import 'dotenv/config';

async function main() {
const result = await generateText({
model: wrapLanguageModel({
model: fireworks('accounts/fireworks/models/qwq-32b'),
middleware: extractReasoningMiddleware({
tagName: 'think',
startWithReasoning: true,
}),
}),
prompt: 'Invent a new holiday and describe its traditions.',
});

console.log('\nREASONING:\n');
console.log(result.reasoning);

console.log('\nTEXT:\n');
console.log(result.text);

console.log();
console.log('Usage:', result.usage);
}

main().catch(console.error);
36 changes: 36 additions & 0 deletions examples/ai-core/src/stream-text/fireworks-reasoning.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { fireworks } from '@ai-sdk/fireworks';
import { extractReasoningMiddleware, streamText, wrapLanguageModel } from 'ai';
import 'dotenv/config';

async function main() {
const result = streamText({
model: wrapLanguageModel({
model: fireworks('accounts/fireworks/models/qwq-32b'),
middleware: extractReasoningMiddleware({
tagName: 'think',
startWithReasoning: true,
}),
}),
prompt: 'How many "r"s are in the word "strawberry"?',
});

let enteredReasoning = false;
let enteredText = false;
for await (const part of result.fullStream) {
if (part.type === 'reasoning') {
if (!enteredReasoning) {
enteredReasoning = true;
console.log('\nREASONING:\n');
}
process.stdout.write(part.textDelta);
} else if (part.type === 'text-delta') {
if (!enteredText) {
enteredText = true;
console.log('\nTEXT:\n');
}
process.stdout.write(part.textDelta);
}
}
}

main().catch(console.error);
1 change: 1 addition & 0 deletions packages/fireworks/src/fireworks-chat-settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export type FireworksChatModelId =
| 'accounts/fireworks/models/qwen-qwq-32b-preview'
| 'accounts/fireworks/models/qwen2-vl-72b-instruct'
| 'accounts/fireworks/models/llama-v3p2-11b-vision-instruct'
| 'accounts/fireworks/models/qwq-32b'
| 'accounts/fireworks/models/yi-large'
| (string & {});

Expand Down

0 comments on commit 9dcc12d

Please sign in to comment.