[WIP] making a working demo for all possible seekers questions

This commit is contained in:
Eliyan
2025-10-14 17:44:27 +02:00
parent 28b0360ddb
commit e863a0a5ea
3 changed files with 142 additions and 21 deletions

View File

@@ -8,11 +8,13 @@ This is a **Proof of Concept (PoC)** that demonstrates the conversion of natural
## Features
- Converts natural language requests into ODMDB DSL queries
- Handles temporal queries ("new seekers since last week")
- Maps human-readable field names to schema fields
- Validates output using Zod schema validation
- Uses OpenAI's structured output for reliable JSON generation
- **Natural Language Processing**: Converts human questions into structured ODMDB queries
- **Real ODMDB Integration**: Works with actual ODMDB data from `../smatchitObjectOdmdb/`
- **Schema-Based Mapping**: Uses actual seekers.json schema for accurate field mapping (62 properties)
- **Local Data Execution**: Processes queries against local seeker files in `objects/seekers/itm/`
- **OpenAI Structured Output**: Ensures reliable JSON query generation
- **Query Validation**: Validates generated queries against real ODMDB schema rules
- **jq Integration**: Powerful result processing, filtering, and CSV export capabilities
## Prerequisites
@@ -21,13 +23,24 @@ This is a **Proof of Concept (PoC)** that demonstrates the conversion of natural
## Installation
1. Install dependencies:
1. Make sure you have the ODMDB data structure available:
```
../smatchitObjectOdmdb/
├── schema/
│ └── seekers.json # Seeker schema (62 properties)
└── objects/
└── seekers/
└── itm/ # Individual seeker JSON files
```
2. Install dependencies:
```bash
npm install
```
2. Set your OpenAI API key:
3. Set your OpenAI API key:
```bash
export OPENAI_API_KEY=sk-your-api-key-here
```
@@ -48,10 +61,6 @@ npm start
EXECUTE_QUERY=true npm start
```
**With Custom ODMDB Server:**
```bash
EXECUTE_QUERY=true ODMDB_BASE_URL=http://localhost:8080 npm start
```
This will process the hardcoded natural language query and output the generated ODMDB query in JSON format. When `EXECUTE_QUERY=true`, it will also execute the query against the ODMDB server.
@@ -67,17 +76,28 @@ const NL_QUERY = "your natural language query here";
### Example Queries
**Status-based queries:**
- `"show me seekers with status startasap and their email and experience"`
- `"find seekers looking for jobs urgently with their skills"`
**Date-based queries:**
- `"give me new seekers since last week with email and experience"`
- `"find recent seekers with job titles and salary expectations"`
- `"show me seekers from yesterday with their skills"`
### Testing jq Processing
**Field-specific queries:**
- `"find seekers with job titles and salary expectations"`
- `"show me seeker locations and availability"`
**Supported filter types:**
- **Status filtering**: `seekstatus` (startasap, norush, notlooking)
- **Date filtering**: `dt_create` with date ranges
- **Index optimization**: Uses ODMDB indexes for efficient queries
To test the jq processing capabilities with mock data:
```bash
node test-jq.js
```
This demonstrates various jq operations including: