Skip to content
Snippets Groups Projects
Unverified Commit 21769c8a authored by clean99's avatar clean99 Committed by GitHub
Browse files

Fix: update deprecated response property in examples (#1614)

parent 89ea1e1d
Branches
Tags
No related merge requests found
---
"@llamaindex/examples": minor
---
Update deprecated response property of query engine to message.content propery
......@@ -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(() => {
......
......@@ -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(() => {
......
......@@ -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();
......@@ -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);
......@@ -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);
......@@ -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) => {
......
......@@ -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);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment