You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: predictGender/index.js
+13-7Lines changed: 13 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
exportdefault{
2
-
asyncfetch(request,env,ctx){
2
+
asyncfetch(request,env){
3
3
// Handle CORS for browser requests
4
4
if(request.method==='OPTIONS'){
5
5
returnnewResponse(null,{
@@ -26,19 +26,25 @@ export default {
26
26
}
27
27
28
28
// Use env.AI directly - no import needed in dashboard editor
29
-
constsystemPrompt=`You are a helpful assistant that always responds with valid JSON.
30
-
Follow this exact schema: { "gender": "string (M|F|CF|X|NB)", "confidence": "number (decimal between 0 and 1)" }
29
+
constsystemPrompt=`You are a helpful assistant that always responds with valid JSON.
30
+
Follow this exact schema: { "gender": "string (M|F|CF|X|NB)" }
31
31
32
32
Rules:
33
33
- Always return valid JSON
34
34
- Follow the provided schema exactly
35
35
- Do not include any text outside the JSON object
36
36
- Ensure all required fields are present
37
-
- Consider Latin American and Spanish naming conventions when analyzing names`;
37
+
- Consider Latin American and Spanish naming conventions when analyzing names
38
+
- Use 'M' if it is a male name.
39
+
- Use 'F' if it is a female name.
40
+
- Use 'CF' if it is a list of names in spanish, either comma separated or separated by 'y' and at least one of the names is female.
41
+
- Use 'F' if it is a list of names in spanish and all of them are female names.
42
+
- Use 'NB' if it is a traditionally non binary name or you know this person is non binary.
43
+
- Use 'X' if it is an organization or entity that is not a person and has no gender.`;
38
44
39
-
constuserPrompt=`JSON with the format { gender: 'M'|'F'|'CF'|'X'|'NB', confidence: number } where gender is the probable gender of a person with the name "${name}" and confidence is the decimal percentage of gender certainty. 'M' is for male, 'F' for female, 'CF' for a list of people where at least one is female, 'NB' for non-binary person, and 'X' for an organization or entity that is not a person and has no gender. Consider Latin American naming conventions.`;
45
+
constuserPrompt=`JSON with the format { gender: 'M'|'F'|'CF'|'X'|'NB'} where gender is the probable gender of a person with the name "${name}".`;
0 commit comments