Skip to content

Commit 9bf6cac

Browse files
committed
Add optional context parameter for scoring directives
Exposes the new API-side context field on resumeJobMatchScore() so callers can steer the scoring engine via EMPHASIZE / DEEMPHASIZE / CREDIT directives (max 5000 chars). Backwards-compatible — context defaults to null and is only forwarded when provided. Also drops the unused SharpApiJobTypeEnum import and bumps version to 1.1.0.
1 parent 8c0c888 commit 9bf6cac

3 files changed

Lines changed: 46 additions & 9 deletions

File tree

README.md

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,17 @@ const fs = require('fs');
6363
const resumePath = './resume.pdf';
6464
const jobDescription = 'Senior Software Engineer position...';
6565

66+
// Optional scoring directives (max 5000 chars). See "Context directives" below.
67+
const context = `
68+
EMPHASIZE: backend scalability
69+
DEEMPHASIZE: frontend frameworks
70+
CREDIT: AWS
71+
`.trim();
72+
6673
async function calculateMatchScore() {
6774
try {
68-
// Submit matching job
69-
const statusUrl = await service.resumeJobMatchScore(resumePath, jobDescription);
75+
// Submit matching job — language and context are optional
76+
const statusUrl = await service.resumeJobMatchScore(resumePath, jobDescription, 'English', context);
7077
console.log('Job submitted. Status URL:', statusUrl);
7178

7279
// Fetch results (polls automatically until complete)
@@ -126,6 +133,31 @@ For more examples, visit the [Product Page](https://sharpapi.com/en/catalog/ai/h
126133

127134
---
128135

136+
## Context directives
137+
138+
The optional `context` parameter lets you steer the scoring engine using a formal directive contract. The engine recognises three directive shapes, which can be mixed freely in a single string:
139+
140+
| Directive | Effect |
141+
|-----------|--------|
142+
| `EMPHASIZE: <topic>` | Increases the matching metric weight by one step |
143+
| `DEEMPHASIZE: <topic>` | Decreases the matching metric weight by one step |
144+
| `CREDIT: <skill \| tool \| certification>` | Treats the named item as a plausible role requirement even if it is absent from the job description |
145+
146+
Directives influence the `overall_match` score and the individual metric scores before the weighted average is computed.
147+
148+
**Limit:** the context string may be up to **5000 characters**. Requests exceeding the limit fail with HTTP 422.
149+
150+
Example:
151+
152+
```text
153+
EMPHASIZE: backend scalability
154+
DEEMPHASIZE: frontend frameworks
155+
CREDIT: AWS
156+
CREDIT: Kubernetes
157+
```
158+
159+
---
160+
129161
## API Endpoint
130162

131163
**POST** `/hr/resume_job_match_score`

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@sharpapi/sharpapi-node-resume-job-match-score",
3-
"version": "1.0.1",
3+
"version": "1.1.0",
44
"description": "SharpAPI.com Node.js SDK for matching resumes to job descriptions",
55
"main": "src/index.js",
66
"scripts": {

src/SharpApiResumeJobMatchScoreService.js

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const { SharpApiCoreService, SharpApiJobTypeEnum } = require('@sharpapi/sharpapi-node-core');
1+
const { SharpApiCoreService } = require('@sharpapi/sharpapi-node-core');
22

33
/**
44
* Service for matching resumes to job descriptions using SharpAPI.com
@@ -10,7 +10,7 @@ class SharpApiResumeJobMatchScoreService extends SharpApiCoreService {
1010
* @param {string} [apiBaseUrl='https://sharpapi.com/api/v1'] - API base URL
1111
*/
1212
constructor(apiKey, apiBaseUrl = 'https://sharpapi.com/api/v1') {
13-
super(apiKey, apiBaseUrl, '@sharpapi/sharpapi-node-resume-job-match-score/1.0.1');
13+
super(apiKey, apiBaseUrl, '@sharpapi/sharpapi-node-resume-job-match-score/1.1.0');
1414
}
1515

1616
/**
@@ -20,17 +20,22 @@ class SharpApiResumeJobMatchScoreService extends SharpApiCoreService {
2020
* @param {string} resumeFilePath - The path to the resume file (PDF/DOC/DOCX/TXT/RTF).
2121
* @param {string} jobDescription - The job description text to match against.
2222
* @param {string|null} language - The language of the resume and job description. Defaults to 'English'.
23+
* @param {string|null} context - Optional scoring directives (EMPHASIZE: / DEEMPHASIZE: / CREDIT:).
24+
* Max 5000 characters. See README for the directive contract.
2325
* @returns {Promise<string>} - The status URL.
2426
*/
25-
async resumeJobMatchScore(resumeFilePath, jobDescription, language = null) {
26-
const data = {
27+
async resumeJobMatchScore(resumeFilePath, jobDescription, language = null, context = null) {
28+
const data = {
2729
job_description: jobDescription,
28-
content: jobDescription
30+
content: jobDescription
2931
};
3032
if (language) {
3133
data.language = language;
3234
}
33-
const response = await this.makeRequest('POST', SharpApiJobTypeEnum.HR_RESUME_JOB_MATCH_SCORE.url, data, resumeFilePath);
35+
if (context) {
36+
data.context = context;
37+
}
38+
const response = await this.makeRequest('POST', '/hr/resume_job_match_score', data, resumeFilePath);
3439
return this.parseStatusUrl(response);
3540
}
3641
}

0 commit comments

Comments
 (0)