@axiom-lattice/examples-deep_research 1.0.12 → 1.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +2 -2
- package/CHANGELOG.md +8 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @axiom-lattice/examples-deep_research@1.0.
|
|
2
|
+
> @axiom-lattice/examples-deep_research@1.0.13 build /home/runner/work/agentic/agentic/examples/deep_research
|
|
3
3
|
> tsup
|
|
4
4
|
|
|
5
5
|
[34mCLI[39m Building entry: src/index.ts
|
|
@@ -13,5 +13,5 @@
|
|
|
13
13
|
[32mCJS[39m [1mdist/index.js.map [22m[32m16.33 KB[39m
|
|
14
14
|
[32mCJS[39m ⚡️ Build success in 34ms
|
|
15
15
|
[34mDTS[39m Build start
|
|
16
|
-
[32mDTS[39m ⚡️ Build success in
|
|
16
|
+
[32mDTS[39m ⚡️ Build success in 5042ms
|
|
17
17
|
[32mDTS[39m [1mdist/index.d.ts [22m[32m13.00 B[39m
|
package/CHANGELOG.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -31,7 +31,7 @@ var require_package = __commonJS({
|
|
|
31
31
|
"package.json"(exports2, module2) {
|
|
32
32
|
module2.exports = {
|
|
33
33
|
name: "@axiom-lattice/examples-deep_research",
|
|
34
|
-
version: "1.0.
|
|
34
|
+
version: "1.0.13",
|
|
35
35
|
main: "dist/index.js",
|
|
36
36
|
bin: {
|
|
37
37
|
"lattice-deep-research": "./dist/index.js"
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../package.json","../src/index.ts","../src/agents/research/index.ts"],"sourcesContent":["{\n \"name\": \"@axiom-lattice/examples-deep_research\",\n \"version\": \"1.0.12\",\n \"main\": \"dist/index.js\",\n \"bin\": {\n \"lattice-deep-research\": \"./dist/index.js\"\n },\n \"scripts\": {\n \"build\": \"tsup\",\n \"start\": \"node dist/index.js\",\n \"dev\": \"tsup src/index.ts --format cjs --dts --watch --onSuccess \\\"node dist/index.js\\\"\",\n \"dev:nodemon\": \"nodemon --watch 'src/**/*.ts' --watch '../../packages/core/dist/**/*' --exec 'ts-node' -r tsconfig-paths/register src/index.ts\",\n \"dev:serve\": \"tsup src/index.ts --format cjs --dts --watch --serve dist/index.js\",\n \"dev:inspect\": \"tsup src/index.ts --format cjs --dts --watch --onSuccess \\\"node --inspect dist/index.js\\\"\",\n \"lint\": \"tsc --noEmit\",\n \"test\": \"jest\",\n \"test:watch\": \"jest --watch\",\n \"test:coverage\": \"jest --coverage\"\n },\n \"keywords\": [],\n \"author\": \"\",\n \"license\": \"ISC\",\n \"description\": \"Deep Research Server for Axiom Lattice\",\n \"dependencies\": {\n \"@axiom-lattice/core\": \"workspace:*\",\n \"@axiom-lattice/gateway\": \"workspace:*\",\n \"dotenv\": \"^16.6.1\",\n \"uuid\": \"^9.0.1\",\n \"zod\": \"^3.24.2\",\n \"zod-to-json-schema\": \"^3.24.3\"\n },\n \"devDependencies\": {\n \"@types/jest\": \"^29.5.14\",\n \"@types/lodash\": \"^4.17.16\",\n \"@types/node\": \"^20.17.23\",\n \"@types/uuid\": \"^9.0.8\",\n \"@typescript-eslint/eslint-plugin\": \"^7.2.0\",\n \"@typescript-eslint/parser\": \"^7.2.0\",\n \"eslint\": \"^8.57.0\",\n \"jest\": \"^29.7.0\",\n \"nodemon\": \"^3.1.9\",\n \"ts-jest\": \"^29.4.0\",\n \"ts-node\": \"^10.9.2\",\n \"tsup\": \"^8.5.0\",\n \"typescript\": \"^5.8.2\"\n }\n}\n","import dotenv from \"dotenv\";\n\nimport { LatticeGateway } from \"@axiom-lattice/gateway\";\nimport {\n registerCheckpointSaver,\n registerModelLattice,\n} from \"@axiom-lattice/core\";\nimport \"./agents\";\nimport path from \"path\";\n// 在文件开头添加\nconst PACKAGE_VERSION = require(\"../package.json\").version;\nconst BUILD_TIME = new Date().toISOString();\nconst IS_DEV = process.env.NODE_ENV !== \"production\";\n\n// 在启动时输出\nconsole.log(`\n╔═══════════════════════════════════════╗\n║ Lattice Deep Research Server ║\n║ Version: ${PACKAGE_VERSION} ║\n║ Build Time: ${BUILD_TIME} ║\n║ Environment: ${IS_DEV ? \"Development\" : \"Production\"} ║\n╚═══════════════════════════════════════╝\n`);\n// Load environment variables\ndotenv.config({ path: path.resolve(__dirname, \"../.env\") });\n\n// Parse command line arguments for port configuration\nfunction parsePort(): number {\n const args = process.argv.slice(2);\n const portIndex = args.findIndex((arg) => arg === \"--port\" || arg === \"-p\");\n\n if (portIndex !== -1 && args[portIndex + 1]) {\n const port = parseInt(args[portIndex + 1], 10);\n if (!isNaN(port) && port > 0 && port < 65536) {\n return port;\n }\n console.warn(\n `Invalid port value: ${args[portIndex + 1]}, using default port 4001`\n );\n }\n\n // Check environment variable\n if (process.env.PORT) {\n const port = parseInt(process.env.PORT, 10);\n if (!isNaN(port) && port > 0 && port < 65536) {\n return port;\n }\n console.warn(\n `Invalid PORT environment variable: ${process.env.PORT}, using default port 4001`\n );\n }\n\n // Default port\n return 4001;\n}\n\n// Register default model Lattice\nregisterModelLattice(\n \"default\",\n // {\n // model: \"deepseek-chat\",\n // provider: \"deepseek\",\n // streaming: false,\n // }\n // {\n // model: \"deepseek-chat\",\n // provider: \"deepseek\",\n // streaming: false,\n // apiKeyEnvName: \"DEEPSEEK_API_KEY2\",\n // },\n // {\n // model: \"deepseek-v3-250324\",\n // provider: \"volcengine\",\n // streaming: false,\n // },\n {\n model: \"kimi-k2-250905\",\n provider: \"volcengine\",\n streaming: true,\n apiKeyEnvName: \"VOLCENGINE_API_KEY2\",\n }\n // {\n // model: \"kimi-k2-0711-preview\",\n // provider: \"openai\",\n // streaming: true,\n // apiKeyEnvName: \"KIMI_API_KEY\",\n // baseURL: \"https://api.moonshot.cn/v1\",\n // }\n // {\n // model: \"qwen-plus\",\n // provider: \"openai\",\n // streaming: false,\n // apiKeyEnvName: \"DASHSCOPE_API_KEY\",\n // baseURL: \"https://dashscope.aliyuncs.com/compatible-mode/v1\",\n // }\n);\nLatticeGateway.registerLatticeRoutes(LatticeGateway.app);\n\nconst port = parsePort();\nconsole.log(`Starting server on port ${port}`);\n\nLatticeGateway.startAsHttpEndpoint({\n port,\n queueServiceConfig: { type: \"memory\", defaultStartPollingQueue: true },\n});\n","/* eslint-disable no-console */\n\nimport {\n registerAgentLattices,\n AgentType,\n AgentConfig,\n} from \"@axiom-lattice/core\";\nimport z from \"zod\";\n\nconst subResearchPrompt = `You are a dedicated researcher. Your job is to conduct research based on the users questions.\n\nConduct thorough research and then reply to the user with a detailed answer to their question\n\nonly your FINAL answer will be passed on to the user. They will have NO knowledge of anything except your final message, so your final report should be your final message!`;\n\nconst subCritiquePrompt = `You are a dedicated editor. You are being tasked to critique a report.\n\nYou can find the report at \\`final_report.md\\`.\n\nYou can find the question/topic for this report at \\`question.txt\\`.\n\nThe user may ask for specific areas to critique the report in. Respond to the user with a detailed critique of the report. Things that could be improved.\n\nYou can use the search tool to search for information, if that will help you critique the report\n\nDo not write to the \\`final_report.md\\` yourself.\n\nThings to check:\n- Check that each section is appropriately named\n- Check that the report is written as you would find in an essay or a textbook - it should be text heavy, do not let it just be a list of bullet points!\n- Check that the report is comprehensive. If any paragraphs or sections are short, or missing important details, point it out.\n- Check that the article covers key areas of the industry, ensures overall understanding, and does not omit important parts.\n- Check that the article deeply analyzes causes, impacts, and trends, providing valuable insights\n- Check that the article closely follows the research topic and directly answers questions\n- Check that the article has a clear structure, fluent language, and is easy to understand.\n`;\n\n// Prompt prefix to steer the agent to be an expert researcher\nconst researchInstructions = `You are an expert researcher. Your job is to conduct thorough research, and then write a polished report.\n\nThe first thing you should do is to write the original user question to \\`question.txt\\` so you have a record of it.\n\nUse the research-agent to conduct deep research. It will respond to your questions/topics with a detailed answer.\n\nWhen you think you enough information to write a final report, write it to \\`final_report.md\\`\n\nYou can call the critique-agent to get a critique of the final report. After that (if needed) you can do more research and edit the \\`final_report.md\\`\nYou can do this however many times you want until are you satisfied with the result.\n\nOnly edit the file once at a time (if you call this tool in parallel, there may be conflicts).\n\nHere are instructions for writing the final report:\n\n<report_instructions>\n\nCRITICAL: Make sure the answer is written in the same language as the human messages! If you make a todo plan - you should note in the plan what language the report should be in so you dont forget!\nNote: the language the report should be in is the language the QUESTION is in, not the language/country that the question is ABOUT.\n\nPlease create a detailed answer to the overall research brief that:\n1. Is well-organized with proper headings (# for title, ## for sections, ### for subsections)\n2. Includes specific facts and insights from the research\n3. References relevant sources using [Title](URL) format\n4. Provides a balanced, thorough analysis. Be as comprehensive as possible, and include all information that is relevant to the overall research question. People are using you for deep research and will expect detailed, comprehensive answers.\n5. Includes a \"Sources\" section at the end with all referenced links\n\nYou can structure your report in a number of different ways. Here are some examples:\n\nTo answer a question that asks you to compare two things, you might structure your report like this:\n1/ intro\n2/ overview of topic A\n3/ overview of topic B\n4/ comparison between A and B\n5/ conclusion\n\nTo answer a question that asks you to return a list of things, you might only need a single section which is the entire list.\n1/ list of things or table of things\nOr, you could choose to make each item in the list a separate section in the report. When asked for lists, you don't need an introduction or conclusion.\n1/ item 1\n2/ item 2\n3/ item 3\n\nTo answer a question that asks you to summarize a topic, give a report, or give an overview, you might structure your report like this:\n1/ overview of topic\n2/ concept 1\n3/ concept 2\n4/ concept 3\n5/ conclusion\n\nIf you think you can answer the question with a single section, you can do that too!\n1/ answer\n\nREMEMBER: Section is a VERY fluid and loose concept. You can structure your report however you think is best, including in ways that are not listed above!\nMake sure that your sections are cohesive, and make sense for the reader.\n\nFor each section of the report, do the following:\n- Use simple, clear language\n- Use ## for section title (Markdown format) for each section of the report\n- Do NOT ever refer to yourself as the writer of the report. This should be a professional report without any self-referential language.\n- Do not say what you are doing in the report. Just write the report without any commentary from yourself.\n- Each section should be as long as necessary to deeply answer the question with the information you have gathered. It is expected that sections will be fairly long and verbose. You are writing a deep research report, and users will expect a thorough answer.\n- Use bullet points to list out information when appropriate, but by default, write in paragraph form.\n\nREMEMBER:\nThe brief and research may be in English, but you need to translate this information to the right language when writing the final answer.\nMake sure the final answer report is in the SAME language as the human messages in the message history.\n\nFormat the report in clear markdown with proper structure and include source references where appropriate.\n\n<Citation Rules>\n- Assign each unique URL a single citation number in your text\n- End with ### Sources that lists each source with corresponding numbers\n- IMPORTANT: Number sources sequentially without gaps (1,2,3,4...) in the final list regardless of which sources you choose\n- Each source should be a separate line item in a list, so that in markdown it is rendered as a list.\n- Example format:\n [1] Source Title: URL\n [2] Source Title: URL\n- Citations are extremely important. Make sure to include these, and pay a lot of attention to getting these right. Users will often use these citations to look into more information.\n</Citation Rules>\n</report_instructions>\n\nYou have access to a few tools.\n\n## \\`internet_search\\`\n\nUse this to run an internet search for a given query. You can specify the number of results, the topic, and whether raw content should be included.\n`;\n\nconst research_agents: AgentConfig[] = [\n {\n key: \"deep_research_agent\",\n name: \"Deep Research Agent\",\n description:\n \"Used to research more in depth questions. Only give this researcher one topic at a time. Do not pass multiple sub questions to this researcher. Instead, you should break down a large topic into the necessary components, and then call multiple research agents in parallel, one for each sub question.\",\n type: AgentType.DEEP_AGENT,\n tools: [\"internet_search\"],\n prompt: researchInstructions,\n subAgents: [\"critique-agent\", \"research-agent\"],\n schema: z.object({\n test: z.string().optional(),\n }),\n },\n {\n key: \"research-agent\",\n name: \"research-agent\",\n type: AgentType.REACT,\n description:\n \"Used to research more in depth questions. Only give this researcher one topic at a time. Do not pass multiple sub questions to this researcher. Instead, you should break down a large topic into the necessary components, and then call multiple research agents in parallel, one for each sub question.\",\n prompt: subResearchPrompt,\n tools: [\"internet_search\"],\n },\n {\n key: \"critique-agent\",\n name: \"critique-agent\",\n type: AgentType.REACT,\n description:\n \"Used to critique the final report. Give this agent some infomration about how you want it to critique the report.\",\n prompt: subCritiquePrompt,\n },\n];\n\nregisterAgentLattices(research_agents);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;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AAE;AAE7C,8BAAe,oBAAoB;AAAA,EACjC;AAAA,EACA,oBAAoB,EAAE,MAAM,UAAU,0BAA0B,KAAK;AACvE,CAAC;","names":["exports","module","import_core","z","dotenv","path","port"]}
|
|
1
|
+
{"version":3,"sources":["../package.json","../src/index.ts","../src/agents/research/index.ts"],"sourcesContent":["{\n \"name\": \"@axiom-lattice/examples-deep_research\",\n \"version\": \"1.0.13\",\n \"main\": \"dist/index.js\",\n \"bin\": {\n \"lattice-deep-research\": \"./dist/index.js\"\n },\n \"scripts\": {\n \"build\": \"tsup\",\n \"start\": \"node dist/index.js\",\n \"dev\": \"tsup src/index.ts --format cjs --dts --watch --onSuccess \\\"node dist/index.js\\\"\",\n \"dev:nodemon\": \"nodemon --watch 'src/**/*.ts' --watch '../../packages/core/dist/**/*' --exec 'ts-node' -r tsconfig-paths/register src/index.ts\",\n \"dev:serve\": \"tsup src/index.ts --format cjs --dts --watch --serve dist/index.js\",\n \"dev:inspect\": \"tsup src/index.ts --format cjs --dts --watch --onSuccess \\\"node --inspect dist/index.js\\\"\",\n \"lint\": \"tsc --noEmit\",\n \"test\": \"jest\",\n \"test:watch\": \"jest --watch\",\n \"test:coverage\": \"jest --coverage\"\n },\n \"keywords\": [],\n \"author\": \"\",\n \"license\": \"ISC\",\n \"description\": \"Deep Research Server for Axiom Lattice\",\n \"dependencies\": {\n \"@axiom-lattice/core\": \"workspace:*\",\n \"@axiom-lattice/gateway\": \"workspace:*\",\n \"dotenv\": \"^16.6.1\",\n \"uuid\": \"^9.0.1\",\n \"zod\": \"^3.24.2\",\n \"zod-to-json-schema\": \"^3.24.3\"\n },\n \"devDependencies\": {\n \"@types/jest\": \"^29.5.14\",\n \"@types/lodash\": \"^4.17.16\",\n \"@types/node\": \"^20.17.23\",\n \"@types/uuid\": \"^9.0.8\",\n \"@typescript-eslint/eslint-plugin\": \"^7.2.0\",\n \"@typescript-eslint/parser\": \"^7.2.0\",\n \"eslint\": \"^8.57.0\",\n \"jest\": \"^29.7.0\",\n \"nodemon\": \"^3.1.9\",\n \"ts-jest\": \"^29.4.0\",\n \"ts-node\": \"^10.9.2\",\n \"tsup\": \"^8.5.0\",\n \"typescript\": \"^5.8.2\"\n }\n}\n","import dotenv from \"dotenv\";\n\nimport { LatticeGateway } from \"@axiom-lattice/gateway\";\nimport {\n registerCheckpointSaver,\n registerModelLattice,\n} from \"@axiom-lattice/core\";\nimport \"./agents\";\nimport path from \"path\";\n// 在文件开头添加\nconst PACKAGE_VERSION = require(\"../package.json\").version;\nconst BUILD_TIME = new Date().toISOString();\nconst IS_DEV = process.env.NODE_ENV !== \"production\";\n\n// 在启动时输出\nconsole.log(`\n╔═══════════════════════════════════════╗\n║ Lattice Deep Research Server ║\n║ Version: ${PACKAGE_VERSION} ║\n║ Build Time: ${BUILD_TIME} ║\n║ Environment: ${IS_DEV ? \"Development\" : \"Production\"} ║\n╚═══════════════════════════════════════╝\n`);\n// Load environment variables\ndotenv.config({ path: path.resolve(__dirname, \"../.env\") });\n\n// Parse command line arguments for port configuration\nfunction parsePort(): number {\n const args = process.argv.slice(2);\n const portIndex = args.findIndex((arg) => arg === \"--port\" || arg === \"-p\");\n\n if (portIndex !== -1 && args[portIndex + 1]) {\n const port = parseInt(args[portIndex + 1], 10);\n if (!isNaN(port) && port > 0 && port < 65536) {\n return port;\n }\n console.warn(\n `Invalid port value: ${args[portIndex + 1]}, using default port 4001`\n );\n }\n\n // Check environment variable\n if (process.env.PORT) {\n const port = parseInt(process.env.PORT, 10);\n if (!isNaN(port) && port > 0 && port < 65536) {\n return port;\n }\n console.warn(\n `Invalid PORT environment variable: ${process.env.PORT}, using default port 4001`\n );\n }\n\n // Default port\n return 4001;\n}\n\n// Register default model Lattice\nregisterModelLattice(\n \"default\",\n // {\n // model: \"deepseek-chat\",\n // provider: \"deepseek\",\n // streaming: false,\n // }\n // {\n // model: \"deepseek-chat\",\n // provider: \"deepseek\",\n // streaming: false,\n // apiKeyEnvName: \"DEEPSEEK_API_KEY2\",\n // },\n // {\n // model: \"deepseek-v3-250324\",\n // provider: \"volcengine\",\n // streaming: false,\n // },\n {\n model: \"kimi-k2-250905\",\n provider: \"volcengine\",\n streaming: true,\n apiKeyEnvName: \"VOLCENGINE_API_KEY2\",\n }\n // {\n // model: \"kimi-k2-0711-preview\",\n // provider: \"openai\",\n // streaming: true,\n // apiKeyEnvName: \"KIMI_API_KEY\",\n // baseURL: \"https://api.moonshot.cn/v1\",\n // }\n // {\n // model: \"qwen-plus\",\n // provider: \"openai\",\n // streaming: false,\n // apiKeyEnvName: \"DASHSCOPE_API_KEY\",\n // baseURL: \"https://dashscope.aliyuncs.com/compatible-mode/v1\",\n // }\n);\nLatticeGateway.registerLatticeRoutes(LatticeGateway.app);\n\nconst port = parsePort();\nconsole.log(`Starting server on port ${port}`);\n\nLatticeGateway.startAsHttpEndpoint({\n port,\n queueServiceConfig: { type: \"memory\", defaultStartPollingQueue: true },\n});\n","/* eslint-disable no-console */\n\nimport {\n registerAgentLattices,\n AgentType,\n AgentConfig,\n} from \"@axiom-lattice/core\";\nimport z from \"zod\";\n\nconst subResearchPrompt = `You are a dedicated researcher. Your job is to conduct research based on the users questions.\n\nConduct thorough research and then reply to the user with a detailed answer to their question\n\nonly your FINAL answer will be passed on to the user. They will have NO knowledge of anything except your final message, so your final report should be your final message!`;\n\nconst subCritiquePrompt = `You are a dedicated editor. You are being tasked to critique a report.\n\nYou can find the report at \\`final_report.md\\`.\n\nYou can find the question/topic for this report at \\`question.txt\\`.\n\nThe user may ask for specific areas to critique the report in. Respond to the user with a detailed critique of the report. Things that could be improved.\n\nYou can use the search tool to search for information, if that will help you critique the report\n\nDo not write to the \\`final_report.md\\` yourself.\n\nThings to check:\n- Check that each section is appropriately named\n- Check that the report is written as you would find in an essay or a textbook - it should be text heavy, do not let it just be a list of bullet points!\n- Check that the report is comprehensive. If any paragraphs or sections are short, or missing important details, point it out.\n- Check that the article covers key areas of the industry, ensures overall understanding, and does not omit important parts.\n- Check that the article deeply analyzes causes, impacts, and trends, providing valuable insights\n- Check that the article closely follows the research topic and directly answers questions\n- Check that the article has a clear structure, fluent language, and is easy to understand.\n`;\n\n// Prompt prefix to steer the agent to be an expert researcher\nconst researchInstructions = `You are an expert researcher. Your job is to conduct thorough research, and then write a polished report.\n\nThe first thing you should do is to write the original user question to \\`question.txt\\` so you have a record of it.\n\nUse the research-agent to conduct deep research. It will respond to your questions/topics with a detailed answer.\n\nWhen you think you enough information to write a final report, write it to \\`final_report.md\\`\n\nYou can call the critique-agent to get a critique of the final report. After that (if needed) you can do more research and edit the \\`final_report.md\\`\nYou can do this however many times you want until are you satisfied with the result.\n\nOnly edit the file once at a time (if you call this tool in parallel, there may be conflicts).\n\nHere are instructions for writing the final report:\n\n<report_instructions>\n\nCRITICAL: Make sure the answer is written in the same language as the human messages! If you make a todo plan - you should note in the plan what language the report should be in so you dont forget!\nNote: the language the report should be in is the language the QUESTION is in, not the language/country that the question is ABOUT.\n\nPlease create a detailed answer to the overall research brief that:\n1. Is well-organized with proper headings (# for title, ## for sections, ### for subsections)\n2. Includes specific facts and insights from the research\n3. References relevant sources using [Title](URL) format\n4. Provides a balanced, thorough analysis. Be as comprehensive as possible, and include all information that is relevant to the overall research question. People are using you for deep research and will expect detailed, comprehensive answers.\n5. Includes a \"Sources\" section at the end with all referenced links\n\nYou can structure your report in a number of different ways. Here are some examples:\n\nTo answer a question that asks you to compare two things, you might structure your report like this:\n1/ intro\n2/ overview of topic A\n3/ overview of topic B\n4/ comparison between A and B\n5/ conclusion\n\nTo answer a question that asks you to return a list of things, you might only need a single section which is the entire list.\n1/ list of things or table of things\nOr, you could choose to make each item in the list a separate section in the report. When asked for lists, you don't need an introduction or conclusion.\n1/ item 1\n2/ item 2\n3/ item 3\n\nTo answer a question that asks you to summarize a topic, give a report, or give an overview, you might structure your report like this:\n1/ overview of topic\n2/ concept 1\n3/ concept 2\n4/ concept 3\n5/ conclusion\n\nIf you think you can answer the question with a single section, you can do that too!\n1/ answer\n\nREMEMBER: Section is a VERY fluid and loose concept. You can structure your report however you think is best, including in ways that are not listed above!\nMake sure that your sections are cohesive, and make sense for the reader.\n\nFor each section of the report, do the following:\n- Use simple, clear language\n- Use ## for section title (Markdown format) for each section of the report\n- Do NOT ever refer to yourself as the writer of the report. This should be a professional report without any self-referential language.\n- Do not say what you are doing in the report. Just write the report without any commentary from yourself.\n- Each section should be as long as necessary to deeply answer the question with the information you have gathered. It is expected that sections will be fairly long and verbose. You are writing a deep research report, and users will expect a thorough answer.\n- Use bullet points to list out information when appropriate, but by default, write in paragraph form.\n\nREMEMBER:\nThe brief and research may be in English, but you need to translate this information to the right language when writing the final answer.\nMake sure the final answer report is in the SAME language as the human messages in the message history.\n\nFormat the report in clear markdown with proper structure and include source references where appropriate.\n\n<Citation Rules>\n- Assign each unique URL a single citation number in your text\n- End with ### Sources that lists each source with corresponding numbers\n- IMPORTANT: Number sources sequentially without gaps (1,2,3,4...) in the final list regardless of which sources you choose\n- Each source should be a separate line item in a list, so that in markdown it is rendered as a list.\n- Example format:\n [1] Source Title: URL\n [2] Source Title: URL\n- Citations are extremely important. Make sure to include these, and pay a lot of attention to getting these right. Users will often use these citations to look into more information.\n</Citation Rules>\n</report_instructions>\n\nYou have access to a few tools.\n\n## \\`internet_search\\`\n\nUse this to run an internet search for a given query. You can specify the number of results, the topic, and whether raw content should be included.\n`;\n\nconst research_agents: AgentConfig[] = [\n {\n key: \"deep_research_agent\",\n name: \"Deep Research Agent\",\n description:\n \"Used to research more in depth questions. Only give this researcher one topic at a time. Do not pass multiple sub questions to this researcher. Instead, you should break down a large topic into the necessary components, and then call multiple research agents in parallel, one for each sub question.\",\n type: AgentType.DEEP_AGENT,\n tools: [\"internet_search\"],\n prompt: researchInstructions,\n subAgents: [\"critique-agent\", \"research-agent\"],\n schema: z.object({\n test: z.string().optional(),\n }),\n },\n {\n key: \"research-agent\",\n name: \"research-agent\",\n type: AgentType.REACT,\n description:\n \"Used to research more in depth questions. Only give this researcher one topic at a time. Do not pass multiple sub questions to this researcher. Instead, you should break down a large topic into the necessary components, and then call multiple research agents in parallel, one for each sub question.\",\n prompt: subResearchPrompt,\n tools: [\"internet_search\"],\n },\n {\n key: \"critique-agent\",\n name: \"critique-agent\",\n type: AgentType.REACT,\n description:\n \"Used to critique the final report. Give this agent some infomration about how you want it to critique the report.\",\n prompt: subCritiquePrompt,\n },\n];\n\nregisterAgentLattices(research_agents);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA,iBAAAA,UAAAC,SAAA;AAAA,IAAAA,QAAA;AAAA,MACE,MAAQ;AAAA,MACR,SAAW;AAAA,MACX,MAAQ;AAAA,MACR,KAAO;AAAA,QACL,yBAAyB;AAAA,MAC3B;AAAA,MACA,SAAW;AAAA,QACT,OAAS;AAAA,QACT,OAAS;AAAA,QACT,KAAO;AAAA,QACP,eAAe;AAAA,QACf,aAAa;AAAA,QACb,eAAe;AAAA,QACf,MAAQ;AAAA,QACR,MAAQ;AAAA,QACR,cAAc;AAAA,QACd,iBAAiB;AAAA,MACnB;AAAA,MACA,UAAY,CAAC;AAAA,MACb,QAAU;AAAA,MACV,SAAW;AAAA,MACX,aAAe;AAAA,MACf,cAAgB;AAAA,QACd,uBAAuB;AAAA,QACvB,0BAA0B;AAAA,QAC1B,QAAU;AAAA,QACV,MAAQ;AAAA,QACR,KAAO;AAAA,QACP,sBAAsB;AAAA,MACxB;AAAA,MACA,iBAAmB;AAAA,QACjB,eAAe;AAAA,QACf,iBAAiB;AAAA,QACjB,eAAe;AAAA,QACf,eAAe;AAAA,QACf,oCAAoC;AAAA,QACpC,6BAA6B;AAAA,QAC7B,QAAU;AAAA,QACV,MAAQ;AAAA,QACR,SAAW;AAAA,QACX,WAAW;AAAA,QACX,WAAW;AAAA,QACX,MAAQ;AAAA,QACR,YAAc;AAAA,MAChB;AAAA,IACF;AAAA;AAAA;;;AC9CA,oBAAmB;AAEnB,qBAA+B;AAC/B,IAAAC,eAGO;;;ACJP,kBAIO;AACP,iB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AAA;AAAA;AAAA,EAiBA;AAAA,IACE,OAAO;AAAA,IACP,UAAU;AAAA,IACV,WAAW;AAAA,IACX,eAAe;AAAA,EACjB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAeF;AACA,8BAAe,sBAAsB,8BAAe,GAAG;AAEvD,IAAM,OAAO,UAAU;AACvB,QAAQ,IAAI,2BAA2B,IAAI,EAAE;AAE7C,8BAAe,oBAAoB;AAAA,EACjC;AAAA,EACA,oBAAoB,EAAE,MAAM,UAAU,0BAA0B,KAAK;AACvE,CAAC;","names":["exports","module","import_core","z","dotenv","path","port"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@axiom-lattice/examples-deep_research",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.13",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"bin": {
|
|
6
6
|
"lattice-deep-research": "./dist/index.js"
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
"uuid": "^9.0.1",
|
|
15
15
|
"zod": "^3.24.2",
|
|
16
16
|
"zod-to-json-schema": "^3.24.3",
|
|
17
|
-
"@axiom-lattice/core": "2.1.
|
|
18
|
-
"@axiom-lattice/gateway": "2.1.
|
|
17
|
+
"@axiom-lattice/core": "2.1.13",
|
|
18
|
+
"@axiom-lattice/gateway": "2.1.18"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"@types/jest": "^29.5.14",
|