Dictionary Tool#21
Open
sharananurag998 wants to merge 2 commits into
Open
Conversation
I've successfully implemented a comprehensive dictionary/explainer tool for Juspay/payment-specific terms with the following components: ### 1. **Glossary JSON** (`src/adk/tools/glossary.json`) - Contains 40+ payment industry terms with detailed definitions - Includes UPI, tokenization, 3DS, PSP, and many more payment-specific terms - Organized by categories (payment-method, security, infrastructure, etc.) - Each term includes: definition, examples, related terms, and category ### 2. **Dictionary Tool** (`src/adk/tools/dictionaryTool.ts`) - **Main dictionary tool**: Look up individual terms with optional context - **Batch lookup tool**: Query multiple terms at once - **Search tool**: Find terms by keyword - **Categories tool**: List all available categories - LLM-ready for enhanced contextual explanations - Case-insensitive search with variations handling ### 3. **Example Files** - **Full example** (`examples/dictionary.ts`): Comprehensive demonstrations with agent integration - **Standalone example** (`examples/dictionary-standalone.ts`): Simple, runnable demo ### Key Features: - ✅ Prebuilt glossary with 40+ payment/fintech terms - ✅ LLM integration capability for contextual explanations - ✅ Multiple tool variants (single, batch, search, categories) - ✅ Working examples demonstrating "What is UPI collect?" and "two-factor authentication" - ✅ Organized by categories for easy navigation - ✅ Related terms and examples included ### To Run: ```bash # Run standalone example pnpm run example:dictionary:standalone # Or directly with tsx npx tsx examples/dictionary-standalone.ts ``` The tool successfully provides definitions for payment terms like UPI collect, tokenization, 2FA, and can provide contextual explanations when needed.
I've successfully created a **core dictionary tool** implementation in `src/tools` (not in ADK) with the following:
### Files Created:
1. **`src/tools/glossary.json`** - Comprehensive glossary with 40+ payment/fintech terms
2. **`src/tools/dictionaryTool.ts`** - Core tool implementation using JAF's `Tool` type
3. **`src/tools/index.ts`** - Export file for all dictionary tools
4. **`examples/dictionary.ts`** - Example demonstrating tool usage
### Tools Implemented:
- **`dictionaryTool`** - Look up individual terms with optional context
- **`batchDictionaryTool`** - Look up multiple terms at once
- **`searchGlossaryTool`** - Search for terms by keyword
- **`listCategoriesTool`** - List all available categories
### Key Features:
✅ Core JAF implementation (no ADK)
✅ Uses `Tool<A, Ctx>` type from `src/core/types.ts`
✅ Zod schemas for parameter validation
✅ 40+ payment terms including UPI, 3DS, tokenization, etc.
✅ Examples for "What is UPI collect?" and "two-factor authentication"
✅ Direct execution capability
### Usage:
```bash
# Run example with direct execution
npx tsx examples/dictionary.ts direct
# Use in code
import { dictionaryTool } from './src/tools/dictionaryTool';
```
The tool successfully provides definitions for payment terms and can be integrated with the JAF engine for agent-based interactions.
7fbbb18 to
e05de49
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.