+
{exampleMessages.map((item) => {
const Icon = item.icon;
return (
diff --git a/lib/agents/query-suggestor.tsx b/lib/agents/query-suggestor.tsx
index e54866be..6637977d 100644
--- a/lib/agents/query-suggestor.tsx
+++ b/lib/agents/query-suggestor.tsx
@@ -17,9 +17,10 @@ export async function querySuggestor(
)
let finalRelatedQueries: PartialRelated = {}
- const result = await streamObject({
- model: (await getModel(false, "auxiliary")) as LanguageModel,
- system: `As a professional web researcher, your task is to generate a set of three queries that explore the subject matter more deeply, building upon the initial query and the information uncovered in its search results.
+ try {
+ const result = await streamObject({
+ model: (await getModel(false, "auxiliary")) as LanguageModel,
+ system: `As a professional web researcher, your task is to generate a set of three queries that explore the subject matter more deeply, building upon the initial query and the information uncovered in its search results.
For instance, if the original query was "Starship's third test flight key milestones", your output should follow this format:
@@ -33,15 +34,18 @@ export async function querySuggestor(
Aim to create queries that progressively delve into more specific aspects, implications, or adjacent topics related to the initial query. The goal is to anticipate the user's potential information needs and guide them towards a more comprehensive understanding of the subject matter.
Please match the language of the response to the user's language.`,
- messages,
- schema: relatedSchema
- })
-
- for await (const obj of result.partialObjectStream) {
- if (obj && typeof obj === 'object' && 'items' in obj) {
- objectStream.update(obj as PartialRelated)
- finalRelatedQueries = obj as PartialRelated
+ messages,
+ schema: relatedSchema
+ })
+
+ for await (const obj of result.partialObjectStream) {
+ if (obj && typeof obj === 'object' && 'items' in obj) {
+ objectStream.update(obj as PartialRelated)
+ finalRelatedQueries = obj as PartialRelated
+ }
}
+ } catch (err) {
+ console.error('querySuggestor: model call failed, returning empty queries:', err)
}
objectStream.done()