Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 71 additions & 0 deletions examples/cv_parser.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
from openai import OpenAI
Copy link

Copilot AI Nov 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This example lacks documentation explaining its purpose and usage. Consider adding:

  1. A module-level docstring describing what the example does
  2. Comments explaining the key parts (e.g., the extraction fields structure, the model call)

Other examples in the repository (e.g., examples/gimkit_quickstart.py) include helpful section headers and comments that guide users through the code.

Copilot uses AI. Check for mistakes.

from gimkit import from_openai
from gimkit import guide as g


client = OpenAI(
api_key="***",
base_url="https://openrouter.ai/api/v1",
)
Comment on lines +7 to +10
Copy link

Copilot AI Nov 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hard-coded API keys, even when masked, should be avoided in example code. This sets a bad precedent for users. Consider using environment variables instead:

import os
from openai import OpenAI

client = OpenAI(
    api_key=os.getenv("OPENAI_API_KEY"),
    base_url="https://openrouter.ai/api/v1",
)

This approach is consistent with other examples in the repository (see examples/hello_world.py which uses environment variables).

Copilot uses AI. Check for mistakes.
model = from_openai(client, model_name="qwen/qwen3-235b-a22b")

cv_content = ""
Copy link

Copilot AI Nov 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The cv_content variable is an empty string, which makes this example non-functional. For a CV parser example to be useful, it should either:

  1. Include sample CV text content, or
  2. Show how to load CV content from a file, or
  3. Include a comment explaining that users should replace this with their own CV content

Consider adding a docstring at the top of the file explaining the example's purpose and how to use it.

Copilot uses AI. Check for mistakes.
extraction_fields = f'''
{{
"name": "{g.person_name()}",
"birthDay": "{g.datetime(require_time=False)}",
"phone": "{g.phone_number()}",
"email": "{g.e_mail()}",
"paperCount": "{g()}",
"ccfACount": "{g()}",
"scholarship": "{g()}",
"competitionAward": "{g()}",
"honors": "{g()}",
"homepageUrl": "{g()}",
"googleScholarUrl": "{g()}",
"githubUrl": "{g()}",
"citationCount": "{g()}",
"hIndex": "{g()}",
"talentEducationalParamList": [
{{
"degreeLevel": "{g.select(choices=["BACHELOR", "MASTER", "DOCTOR"])}",
"school": "{g()}",
"department": "{g()}",
"major": "{g()}",
"advisor": "{g()}",
"advisorTitles": "{g()}",
"lab": "{g()}",
"researchDirection": "{g()}",
"startDate": "{g.datetime(require_time=False)}",
"endDate": "{g.datetime(require_time=False)}",
}},
{{
"degreeLevel": "{g.select(choices=["BACHELOR", "MASTER", "DOCTOR"])}",
"school": "{g()}",
"department": "{g()}",
"major": "{g()}",
"advisor": "{g()}",
"advisorTitles": "{g()}",
"lab": "{g()}",
"researchDirection": "{g()}",
"startDate": "{g.datetime(require_time=False)}",
"endDate": "{g.datetime(require_time=False)}",
}},
{{
"degreeLevel": "{g.select(choices=["BACHELOR", "MASTER", "DOCTOR"])}",
"school": "{g()}",
"department": "{g()}",
"major": "{g()}",
"advisor": "{g()}",
"advisorTitles": "{g()}",
"lab": "{g()}",
"researchDirection": "{g()}",
"startDate": "{g.datetime(require_time=False)}",
"endDate": "{g.datetime(require_time=False)}",
}}
]
}}'''

result = model(cv_content + extraction_fields, output_type="json", use_gim_prompt=True)
print(result)
Loading