diff --git a/.changeset/neat-masks-smell.md b/.changeset/neat-masks-smell.md new file mode 100644 index 0000000000000000000000000000000000000000..5dcfea80d3fbd57c5e8b0416de0b29a348d3d9ee --- /dev/null +++ b/.changeset/neat-masks-smell.md @@ -0,0 +1,5 @@ +--- +"@llamaindex/examples": minor +--- + +Update deprecated response property of query engine to message.content propery diff --git a/examples/agent/query_openai_agent.ts b/examples/agent/query_openai_agent.ts index 57dc838f59724745c68e6a6ed6dd60d3c56ed8f3..dc8b63b9f0610b4f518d22610f7086d03e421d15 100644 --- a/examples/agent/query_openai_agent.ts +++ b/examples/agent/query_openai_agent.ts @@ -33,12 +33,12 @@ async function main() { }); // Chat with the agent - const response = await agent.chat({ + const { message } = await agent.chat({ message: "What was his first salary?", }); // Print the response - console.log(response.response); + console.log(message.content); } void main().then(() => { diff --git a/examples/agent/retriever_openai_agent.ts b/examples/agent/retriever_openai_agent.ts index 09e940951bf7ed428887a2d50ee51cb44d5a51bc..e9e5d84aa693ec2acd732e9d6b42f788ccba6bc2 100644 --- a/examples/agent/retriever_openai_agent.ts +++ b/examples/agent/retriever_openai_agent.ts @@ -52,12 +52,12 @@ async function main() { }); // Chat with the agent - const response = await agent.chat({ + const { message } = await agent.chat({ message: "What was his first salary?", }); // Print the response - console.log(response.response); + console.log(message.content); } void main().then(() => { diff --git a/examples/anthropic/agent.ts b/examples/anthropic/agent.ts index 5e5a6495126c747dc82c06e761c8351fc136cddc..8892dc40ef852f76b433ce05fd0f2928b2bc64de 100644 --- a/examples/anthropic/agent.ts +++ b/examples/anthropic/agent.ts @@ -38,12 +38,12 @@ const agent = new AnthropicAgent({ }); async function main() { - const { response } = await agent.chat({ + const { message } = await agent.chat({ message: "What is the weather in New York? What's the history of New York from Wikipedia in 3 sentences?", }); - console.log(response); + console.log(message.content); } void main(); diff --git a/examples/groq.ts b/examples/groq.ts index 624c1c7b8697d355e41c4d7a476e37c4c64d2155..1c7b4b9af2831e37d4ae227a007860c53c86725e 100644 --- a/examples/groq.ts +++ b/examples/groq.ts @@ -38,12 +38,12 @@ async function main() { const query = "What is the meaning of life?"; // Query - const response = await queryEngine.query({ + const { message } = await queryEngine.query({ query, }); // Log the response - console.log(response.response); + console.log(message.content); } main().catch(console.error); diff --git a/examples/rerankers/CohereReranker.ts b/examples/rerankers/CohereReranker.ts index c838d54d7734395d91fdd00c471c6f04a6719b0f..6b4bda87bbbd3128ac9a7c0fd635f7c4a8b65a4c 100644 --- a/examples/rerankers/CohereReranker.ts +++ b/examples/rerankers/CohereReranker.ts @@ -33,19 +33,19 @@ async function main() { retriever, }); - const response = await queryEngine.query({ + const { message } = await queryEngine.query({ query: "What did the author do growing up?", }); // cohere response - console.log(response.response); + console.log(message.content); - const baseResponse = await baseQueryEngine.query({ + const { message: baseMessage } = await baseQueryEngine.query({ query: "What did the author do growing up?", }); // response without cohere - console.log(baseResponse.response); + console.log(baseMessage.content); } main().catch(console.error); diff --git a/examples/vectorIndex.ts b/examples/vectorIndex.ts index b5403788fde6e456d5d78291326447aaab346668..f0cc50232663cad40517feb4b9a6fddd682f08d4 100644 --- a/examples/vectorIndex.ts +++ b/examples/vectorIndex.ts @@ -21,12 +21,12 @@ async function main() { // Query the index const queryEngine = index.asQueryEngine(); - const { response, sourceNodes } = await queryEngine.query({ + const { message, sourceNodes } = await queryEngine.query({ query: "What did the author do in college?", }); // Output response with sources - console.log(response); + console.log(message.content); if (sourceNodes) { sourceNodes.forEach((source: NodeWithScore, index: number) => { diff --git a/examples/vectorIndexCustomize.ts b/examples/vectorIndexCustomize.ts index 9f04c704864bbc61344830c8a7f7fdbfe9823502..437a5415bc098a38a00adb5e9dc327dea3e4f2e3 100644 --- a/examples/vectorIndexCustomize.ts +++ b/examples/vectorIndexCustomize.ts @@ -29,10 +29,10 @@ async function main() { nodePostprocessor, ]); - const response = await queryEngine.query({ + const { message } = await queryEngine.query({ query: "What did the author do growing up?", }); - console.log(response.response); + console.log(message.content); } main().catch(console.error);