POST: /document/embedding
This endpoint allows you to generate item \(profile or job\) embedding.
item must have the same shape as defined for profile or job
post
https://api.hrflow.ai
/v1/document/embedding/
Post /document/embedding

Embedding :

Embeddings are base64 encoded.
In order to retrieve embedding as list[list], the result must be decoded (base64) and reshaped (-1, 1024). Refer to decode_float_list below for implementation example.
Python
Javascript
1
from hrflow import Hrflow
2
import base64
3
import numpy as np
4
5
dfloat32 = np.dtype('>f4')
6
7
8
def decode_float_list(base64_string):
9
bytes = base64.b64decode(base64_string)
10
np_array = np.frombuffer(bytes, dtype=dfloat32)
11
return np.reshape(np_array, (-1, 1024)).tolist()
12
13
14
def encode_array(arr):
15
base64_str = base64.b64encode(np.array(arr).astype(dfloat32)).decode("utf-8")
16
return base64_str
17
18
19
client = Hrflow(api_secret="Your API Key", api_user="Your API user email")
20
21
22
profile_json = {
23
"consent_algorithmic": {
24
"owner": {
25
"parsing": True,
26
"revealing": False,
27
"embedding": True,
28
"searching": False,
29
"scoring": True,
30
"reasoning": False
31
},
32
"controller": {
33
"parsing": True,
34
"revealing": False,
35
"embedding": True,
36
"searching": False,
37
"scoring": True,
38
"reasoning": False
39
}
40
},
41
"info" : {
42
"full_name":"Harry Potter",
43
"first_name": "Harry",
44
"last_name": "Potter",
45
"email":"[email protected]",
46
"phone":"0202",
47
"gender": None,
48
"urls": {
49
"from_resume": [],
50
"linkedin":"",
51
"twitter":"",
52
"facebook":"",
53
"github":"",
54
"picture":""},
55
"picture":None,
56
"location":{"text": None},
57
"summary": "Brief summary"
58
},
59
"experiences": [{
60
"date_start": "2016-01-01T00:00:00",
61
"date_end": {"iso8601": "2018-07-01T00:00:00"},
62
"title": "Lead",
63
"company": "Mathematic Departement",
64
"location": {"text":"Paris"},
65
"description": "Developping."
66
}],
67
"experiences_duration":5,
68
"educations": [{
69
"date_start": {"iso8601": "2016-01-01T00:00:00"},
70
"date_end": {"iso8601": "2018-01-01T00:00:00"},
71
"title": "Mathematicien",
72
"school": "University",
73
"description": "Description",
74
"location": {"text":"Scotland", "lat":"lat", "lng": "lng"}
75
}],
76
"educations_duration":4,
77
"skills": [{"name":"manual skill", "type": "hard", "value": None},
78
{"name":"Creative spirit", "type": "soft","value": None},
79
{"name":"Writing skills", "type": "hard","value": None},
80
{"name":"Communication", "type": "soft","value": None}],
81
"languages" : [{"name":"english", "value": None}],
82
"interests": [{"name":"football", "value": None}],
83
"tags":[{"name":"archive", "value": False}],
84
"metadatas":[],
85
"labels":[{"stage":"yes", "job_key":"job_key"}],
86
"attachments": []
87
}
88
89
response = client.document.embedding.post(item_type="profile",
90
item=profile_json,
91
return_sequences=True)
92
93
embedding = decode_float_list(response.get('data'))
Copied!
1
import Hrflow from 'hrflow';
2
const client = new Hrflow({
3
api_secret: 'Your API Key',
4
api_user: 'Your API user email'
5
});
6
7
const profile_json = {
8
"consent_algorithmic": {
9
"owner": {
10
"parsing": true,
11
"revealing": false,
12
"embedding": true,
13
"searching": false,
14
"scoring": true,
15
"reasoning": false
16
},
17
"controller": {
18
"parsing": true,
19
"revealing": false,
20
"embedding": true,
21
"searching": false,
22
"scoring": true,
23
"reasoning": false
24
}
25
},
26
"info" : {
27
"full_name":"Harry Potter",
28
"first_name": "Harry",
29
"last_name": "Potter",
30
"email":"[email protected]",
31
"phone":"0202",
32
"gender": null,
33
"urls": {
34
"from_resume": [],
35
"linkedin":"",
36
"twitter":"",
37
"facebook":"",
38
"github":"",
39
"picture":""},
40
"picture":null,
41
"location":{"text": null},
42
"summary": "Brief summary"
43
},
44
"experiences": [{
45
"date_start": "2016-01-01T00:00:00",
46
"date_end": {"iso8601": "2018-07-01T00:00:00"},
47
"title": "Lead",
48
"company": "Mathematic Departement",
49
"location": {"text":"Paris"},
50
"description": "Developping."
51
}],
52
"experiences_duration":5,
53
"educations": [{
54
"date_start": {"iso8601": "2016-01-01T00:00:00"},
55
"date_end": {"iso8601": "2018-01-01T00:00:00"},
56
"title": "Mathematicien",
57
"school": "University",
58
"description": "Description",
59
"location": {"text":"Scotland", "lat":"lat", "lng": "lng"}
60
}],
61
"educations_duration":4,
62
"skills": [{"name":"manual skill", "type": "hard", "value": null},
63
{"name":"Creative spirit", "type": "soft","value": null},
64
{"name":"Writing skills", "type": "hard","value": null},
65
{"name":"Communication", "type": "soft","value": null}],
66
"languages" : [{"name":"english", "value": null}],
67
"interests": [{"name":"football", "value": null}],
68
"tags":[{"name":"archive", "value": false}],
69
"metadatas":[],
70
"labels":[{"stage":"yes", "job_key":"job_key"}],
71
"attachments": []
72
}
73
74
75
client.document.embedding.post("profile", profile_json, true).then(response => {
76
console.log(response);
77
// ...
78
});
Copied!
Last modified 1yr ago