X

microsoft open source

Bing Rank
Average Position of Bing Search Engine Ranking of related query such as 'Sales AI Agent', 'Coding AI Agent', etc.
Google Rank
Average Position of Bing Search Engine Ranking of related query such as 'Sales AI Agent', 'Coding AI Agent', etc.

Last Updated: 2025-04-15

Information

GenAIScript Search GitHub YouTube RSS Select theme Blog Start Here Getting Started Installation Configuration Your first GenAI script Running scripts Debugging Scripts Testing scripts Automating scripts Best Practices Tutorial Notebook Case Studies Bicep Best Practices SEO Front Matter Documentation Translations Blocks Localization Release Notes TLA+ AI Linter Image Alt Text Samples Overview Diagram Lint Pull Request Descriptor Image Alt Textify Pull Request Reviewer Git Commit Message Search and transform Commenter GitHub Action Investigator Spell Checker Guides Prompt As Code Ask My PDF Agentic tools Ask My Image Detection of Outdated Descriptions Present My Code Search and Fetch Tool Agent Summarize Many Documents Containerized Tools Generated Knowledge Phi-3 Mini with Ollama Business card scanner Automated Git Commit Messages Issue Reviewer Llama Guard your files LLM Agents Pull Request Reviewer Search And Transform Transformer.js Using Secrets Video Alt Text Images in Azure Blob Storage LLM as a tool PDF Vision Zod Schema Make It Better Sharing scripts Reference Overview scripts Overview Metadata Prompt ($) Context (env+def) Variables File Output Tools Model Context Protocol Tools Data Schemas Agents DOCX PDF XML Markdown Images Inline prompts Retrieval Secret Scanning System Prompts Vector Search Videos as Inputs Annotations File Merge Tests / Evals Red Team Custom Output Parsers Structured Outputs Files Fetch Cache Output Builder TypeScript Web Search Secrets YAML CSV INI XLSX HTML Choices Containers Content Safety Diagrams Imports Browser Automation Audio Transcription Chat Participants Concurrency GitHub Import Template LogProbs Parameters Schema Git Prompty Model Aliases Pyodide Tokenizers Cast Classify Prompt Caching Microsoft Teams User Input Fence Formats Notebook Reasoning Models Response Priming Cancel cli Overview Run Convert Serve Video Test configure Node.JS API Commands vscode Overview GitHub Copilot Chat Settings Playground Configuration Files Security and Trust Transparency Note Blog FAQ Slides Contributing GitHub YouTube RSS Select theme Overview Using tools Parameters Using system.math Overview Using tools Parameters Using system.math defTool ( " sum " , " Sum two numbers " , { type: " object " , properties: { a: { type: " number " , description: " The first number " , }, b: { type: " number " , description: " The second number " , }, }, required: [ " a " , " b " ], }, ( { a, b } { a , b } ) => ` ${ a + b } ` ) defTool ( " sum " , " Sum two numbers " , { a: 1 , b: 2 } , ( { a, b } { a , b } ) => ` ${ a + b } ` ) script ({ ... , parameters : { " question " : { type: " string " , default: " How much is 5 + 5? then divide by 2? " } } }) ... $ ` Answer the following arithmetic question: ${ env . vars . question } ` script ({ title: " math-agent " , model: " small " , description: " A port of https://ts.llamaindex.ai/examples/agent " , parameters: { question: { type: " string " , default: " How much is 11 + 4? then divide by 3? " , }, }, tests: { description: " Testing the default prompt " , keywords: " 5 " , }, }) defTool ( " sum " , " Use this function to sum two numbers " , { type: " object " , properties: { a: { type: " number " , description: " The first number " , }, b: { type: " number " , description: " The second number " , }, }, required: [ " a " , " b " ], }, ( { a, b } { a , b } ) => ` ${ a + b } ` ) defTool ( " divide " , " Use this function to divide two numbers " , { type: " object " , properties: { a: { type: " number " , description: " The first number " , }, b: { type: " number " , description: " The second number " , }, }, required: [ " a " , " b " ], }, ( { a, b } { a , b } ) => ` ${ a / b } ` ) $ ` Answer the following arithmetic question: ${ env . vars . question } ` Answer the following arithmetic question: How much is 11 + 4? then divide by 3? 5 The result of (11 + 4) divided by 3 is 5. math-agent.genai.mjs script ({ title: " math-agent-system " , model: " small " , description: " A port of https://ts.llamaindex.ai/examples/agent " , system: [ " system " , " system.math " , " system.tools " ], parameters: { " question " : { type: " string " , default: " How much is (11 + 4 / 9.11)? then divide by 3.13? " } }, tests: { description: " Testing the default prompt " , keywords: " 5 " } }) $ ` Respond this math question: ${ env . vars . question } - do not generate python code - print the final result in text format ` Using tools (formerly functions),you can define a built-in agent that can take decisionsand reasoning based on the tools provided to it. Let’s illustrate this concept using the llamaindex sum div sample:an agent that can sum or divide two numbers and needs to answer basic arithmetic questions. By declaring tools (and providing a descriptive description), you provide the opportunityfor the LLM to requests a tool call during the output generation. In the snippet below,we declare a tool that can sum two numbers. It will be called by the LLM when a sum operationis required. You can also simplify the parameter definition by provider an example object and the schema will be inferred._createMdxContent The arithmetic question can be declared as a script parameter to be used in the agent script. The parameter value are populated in the env.vars object. Putting it all together, we define another tool to divide two numbersand inline an arithmetic question. The system prompt system.mathwraps the parsers.math expression parser and evaluator and exposes it as a tool. This simplifies the agent script as we do not have to define tools anymore.

Prompts

Reviews

Tags

Write Your Review

Detailed Ratings

ALL
Correctness
Helpfulness
Interesting
Upload Pictures and Videos