feder-cr / Auto_Jobs_Applier_AIHawk

Auto_Jobs_Applier_AIHawk is a tool that automates the jobs application process. Utilizing artificial intelligence, it enables users to apply for multiple job offers in an automated and personalized way.
Other
17.69k stars 2.59k forks source link

[GOOD FIRST ISSUE]: Missing secret 'llm_api_key' #516

Open MTAleadgen opened 5 days ago

MTAleadgen commented 5 days ago

Issue summary

no recognizing API key

Detailed description

I've been trying to put my open AI API key in for a couple of hours now with now luck. I've confirmed secrets.yaml is up to date, and have tried 5-10 different syntaxes as well as bringing the key in as an environment variable. Here's my error when I try to run python main.py:

(venv) PS C:\Users\ashdo\OneDrive\Desktop\Job Search\Auto_Jobs_Applier_AIHawk> python main.py 2024-10-11 19:42:39.303 | ERROR | main:main:205 - Configuration error: Missing secret 'llm_api_key' in file data_folder\secrets.yaml 2024-10-11 19:42:39.304 | ERROR | main:main:206 - Refer to the configuration guide for troubleshooting: https://github.com/feder-cr/AIHawk_AIHawk_automatic_job_application/blob/main/readme.md#configuration Missing secret 'llm_api_key' in file data_folder\secrets.yaml

secret.yaml:

llm_api_key: ["${OPENAI_API_KEY}"]

config.yaml

remote: true

experienceLevel: internship: false entry: false associate: false mid-senior level: true director: true executive: true

jobTypes: full-time: true contract: true part-time: false temporary: true internship: false other: false volunteer: true

date: all time: true month: true week: true 24 hours: true

positions:

locations:

apply_once_at_company: true

distance: 100

company_blacklist:

title_blacklist:

- word1

- word2

job_applicants_threshold: min_applicants: 0 max_applicants: 50

llm_model_type: openai llm_model: 'gpt-4o-mini' llm_api_url: https://api.pawan.krd/cosmosrp/v1

plain_text_resume.yaml

personal_information: name: "Michael" surname: "&&&&&&&&&&" date_of_birth: "12/12/1986" # Update with your actual date of birth country: "US" city: "Ferndale" zip_code: "48220" address: "580 &&&&&&& St." phone_prefix: "+1" phone: "****" email: "&&&&&&&&&"

github: "https://github.com/mikeashdown" # Update if applicable

linkedin: "https://www.linkedin.com/in/mikeashdown/"

education_details:

experience_details:

projects:

- name: "Sales Automation Tool"

description: "Developed a Python script to automate LinkedIn job applications, integrating AI-driven resume customization and automated submissions."

link: "https://github.com/mikeashdown/sales-automation-tool"

achievements:

certifications:

languages:

interests:

availability: notice_period: "2 weeks"

salary_expectations: salary_range_usd: "111,573 - 127,311"

self_identification: gender: "Male" pronouns: "He/Him" veteran: "No" disability: "No" ethnicity: "Caucasian"

legal_authorization: eu_work_authorization: "No" legally_allowed_to_work_in_eu: "No" legally_allowed_to_work_in_us: "Yes" requires_eu_sponsorship: "No" canada_work_authorization: "No" requires_canada_visa: "Yes" legally_allowed_to_work_in_canada: "No" requires_canada_sponsorship: "No" uk_work_authorization: "No" requires_uk_visa: "Yes" legally_allowed_to_work_in_uk: "No" requires_uk_sponsorship: "No"

work_preferences: remote_work: "Yes" in_person_work: "yes" open_to_relocation: "Yes" willing_to_complete_assessments: "Yes" willing_to_undergo_drug_tests: "Yes" willing_to_undergo_background_checks: "Yes"

Steps to reproduce (if applicable)

No response

Expected outcome

does not run

Additional context

No response

RushiChaganti commented 4 days ago

Hey @MTAleadgen You need to pass your open ai key in the secrets.yaml file like below image image

MTAleadgen commented 4 days ago

@RushiChaganti - already done - I'm bring it in from .env, and I've put it in directly as well with no luck

mohammadi-com commented 4 days ago

@MTAleadgen What do you mean you're brining in from .env? It should be in the "data_folder/secrets.yaml". You get your api key from ai provider, such as OpenAI and put it there

MTAleadgen commented 4 days ago

well i stored it as an an environment variable, so this statement - llm_api_key: ["${OPENAI_API_KEY}"] - is referencing the .env file where this variable is stored. I've tired putting it directly in the secret.yaml file as well and have had no luck. No matter what I do, i pull this error:

PS C:\Users\ashdo\OneDrive\Desktop\Job Search\Auto_Jobs_Applier_AIHawk> python main.py 2024-10-13 10:14:38.039 | ERROR | main:main:205 - Configuration error: Missing secret 'llm_api_key' in file data_folder\secrets.yaml 2024-10-13 10:14:38.040 | ERROR | main:main:206 - Refer to the configuration guide for troubleshooting: https://github.com/feder-cr/AIHawk_AIHawk_automatic_job_application/blob/main/readme.md#configuration Missing secret 'llm_api_key' in file data_folder\secrets.yaml

mdgjohnny commented 2 days ago

It looks like the issue might be related to how you're referencing the API key in your secrets.yaml file. Since you’re storing the key as an environment variable, there might be an issue with how it's being imported into the YAML file. You said you've tried pasting the key directly into the file. Could you try again with a fresh copy and make sure it's formatted like this:

llm_api_key: "your-openai-api-key-here"

If that works, then we know the issue is with the environment variable reference. If not, there might be something else going on.

sonicnerd14 commented 1 day ago

I've tried putting the api key for Gemini 1.5 Pro into that field, and I get this error when running the script:

`2024-10-15 23:53:48.717 | ERROR | src.aihawk_easy_applier:_create_and_upload_resume:470 - Failed to generate resume: 'LoggerChatModel' object has no attribute 'logger' 2024-10-15 23:53:48.726 | ERROR | src.aihawk_easy_applier:_create_and_upload_resume:472 - Traceback: Traceback (most recent call last): File "c:\Auto_Jobs_Applier_AIHawk\virtual\Lib\site-packages\lib_resume_builder_AIHawk\gpt_resume_job_description.py", line 119, in call reply = self.llm(messages) ^^^^^^^^^^^^^^^^^^ File "c:\Auto_Jobs_Applier_AIHawk\virtual\Lib\site-packages\langchain_core_api\deprecation.py", line 180, in warning_emitting_wrapper return wrapped(args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^ File "c:\Auto_Jobs_Applier_AIHawk\virtual\Lib\site-packages\langchain_core\language_models\chat_models.py", line 1016, in call generation = self.generate( ^^^^^^^^^^^^^^ File "c:\Auto_Jobs_Applier_AIHawk\virtual\Lib\site-packages\langchain_core\language_models\chat_models.py", line 634, in generate raise e File "c:\Auto_Jobs_Applier_AIHawk\virtual\Lib\site-packages\langchain_core\language_models\chat_models.py", line 624, in generate self._generate_with_cache( File "c:\Auto_Jobs_Applier_AIHawk\virtual\Lib\site-packages\langchain_core\language_models\chat_models.py", line 846, in _generate_with_cache result = self._generate( ^^^^^^^^^^^^^^^ File "c:\Auto_Jobs_Applier_AIHawk\virtual\Lib\site-packages\langchain_openai\chat_models\base.py", line 589, in _generate response = self.client.create(payload) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "c:\Auto_Jobs_Applier_AIHawk\virtual\Lib\site-packages\openai_utils_utils.py", line 277, in wrapper return func(args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "c:\Auto_Jobs_Applier_AIHawk\virtual\Lib\site-packages\openai\resources\chat\completions.py", line 646, in create return self._post( ^^^^^^^^^^^ File "c:\Auto_Jobs_Applier_AIHawk\virtual\Lib\site-packages\openai_base_client.py", line 1266, in post return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "c:\Auto_Jobs_Applier_AIHawk\virtual\Lib\site-packages\openai_base_client.py", line 942, in request return self._request( ^^^^^^^^^^^^^^ File "c:\Auto_Jobs_Applier_AIHawk\virtual\Lib\site-packages\openai_base_client.py", line 1046, in _request raise self._make_status_error_from_response(err.response) from None openai.AuthenticationError: Error code: 401 - {'error': {'message': 'Incorrect API key provided: AIzaSyCl***zH7U. You can find your API key at https://platform.openai.com/account/api-keys.', 'type': 'invalid_request_error', 'param': None, 'code': 'invalid_api_key'}}

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "c:\Auto_Jobs_Applier_AIHawk\src\aihawk_easy_applier.py", line 442, in _create_and_upload_resume resume_pdf_base64 = self.resume_generator_manager.pdf_base64(job_description_text=job.description) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "c:\Auto_Jobs_Applier_AIHawk\virtual\Lib\site-packages\lib_resume_builder_AIHawk\manager_facade.py", line 78, in pdf_base64 self.resume_generator.create_resume_job_description_text(style_path, job_description_text, temp_html_path) File "c:\Auto_Jobs_Applier_AIHawk\virtual\Lib\site-packages\lib_resume_builder_AIHawk\resume_generator.py", line 37, in create_resume_job_description_text gpt_answerer.set_job_description_from_text(job_description_text) File "c:\Auto_Jobs_Applier_AIHawk\virtual\Lib\site-packages\lib_resume_builder_AIHawk\gpt_resume_job_description.py", line 247, in set_job_description_from_text output = chain.invoke({"text": job_description_text}) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "c:\Auto_Jobs_Applier_AIHawk\virtual\Lib\site-packages\langchain_core\runnables\base.py", line 2878, in invoke input = context.run(step.invoke, input, config) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "c:\Auto_Jobs_Applier_AIHawk\virtual\Lib\site-packages\langchain_core\runnables\base.py", line 4474, in invoke return self._call_with_config( ^^^^^^^^^^^^^^^^^^^^^^^ File "c:\Auto_Jobs_Applier_AIHawk\virtual\Lib\site-packages\langchain_core\runnables\base.py", line 1785, in _call_with_config context.run( File "c:\Auto_Jobs_Applier_AIHawk\virtual\Lib\site-packages\langchain_core\runnables\config.py", line 398, in call_func_with_variable_args return func(input, kwargs) # type: ignore[call-arg] ^^^^^^^^^^^^^^^^^^^^^ File "c:\Auto_Jobs_Applier_AIHawk\virtual\Lib\site-packages\langchain_core\runnables\base.py", line 4330, in _invoke output = call_func_with_variable_args( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "c:\Auto_Jobs_Applier_AIHawk\virtual\Lib\site-packages\langchain_core\runnables\config.py", line 398, in call_func_with_variable_args return func(input, kwargs) # type: ignore[call-arg] ^^^^^^^^^^^^^^^^^^^^^ File "c:\Auto_Jobs_Applier_AIHawk\virtual\Lib\site-packages\lib_resume_builder_AIHawk\gpt_resume_job_description.py", line 133, in call self.logger.error(f"Unexpected error occurred: {str(e)}, retrying in {retry_delay} seconds... (Attempt {attempt + 1}/{max_retries})") ^^^^^^^^^^^ AttributeError: 'LoggerChatModel' object has no attribute 'logger'

2024-10-15 23:53:48.727 | ERROR | src.aihawk_easy_applier:fill_up:337 - Failed to find form elements: 'LoggerChatModel' object has no attribute 'logger'`

Seems that only key works is OpenAI maybe, but I haven't tried with an OpenAI key yet. I've also to run the script with Ollama using Llama 3.2, but it won't even start without an API key.