Jobs_Applier_AI_Agent_AIHawk icon indicating copy to clipboard operation
Jobs_Applier_AI_Agent_AIHawk copied to clipboard

[GOOD FIRST ISSUE]: Missing secret 'llm_api_key'

Open MTAleadgen opened this issue 1 year ago • 8 comments

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:

  • Sales
  • Account Executive
  • AI Process Engineer
  • Business Development
  • AI Product Manager
  • AI Solutions Architect
  • AI Specialist
  • Automation Engineer
  • Cognitive Solutions Architect
  • AI Implementation Consultant

locations:

  • Cambridge, Massachusetts
  • Stanford, California
  • Oxford, United Kingdom
  • Cambridge, United Kingdom
  • London, United Kingdom
  • Washington, D.C.
  • New York City, New York
  • Princeton, New Jersey
  • Chicago, Illinois
  • New Haven, Connecticut
  • Berkeley, California
  • Cambridge, Massachusetts
  • San Diego, California
  • Paris, France
  • Toronto, Canada
  • Canberra, Australia
  • Ann Arbor, Michigan
  • Ithaca, New York
  • London, United Kingdom
  • Tokyo, Japan
  • Sydney, Australia
  • Beijing, China
  • New York City, New York
  • Geneva, Switzerland
  • Edinburgh, United Kingdom
  • Copenhagen, Denmark
  • Shanghai, China
  • Singapore, Singapore
  • St Andrews, United Kingdom
  • Lima, Peru
  • Bogota, Columbia
  • Brazil

apply_once_at_company: true

distance: 100

company_blacklist:

  • Ajax Tocco
  • Makino SST
  • Absolute Machine Tools
  • Heartland Machine and Engineering

#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:

  • education_level: "Bachelor of Science" institution: "YSU College of STEM" field_of_study: "Mechanical Engineering" final_evaluation_grade: "N/A" # Update if applicable year_of_completion: "2025" start_date: "2019"

additional_info:

exam:

Algorithms: "A"

Linear_Algebra: "A"

Database_Systems: "A"

Operating_Systems: "A-"

Web_Development: "A"

  • education_level: "Bachelor of Science" institution: "Miami University" field_of_study: "Manufacturing Engineering" final_evaluation_grade: "N/A" # Update if applicable year_of_completion: "2010" start_date: "2006" #additional_info:

    exam:

    Relevant_Courses: "N/A" # Add specific courses if applicable

  • education_level: "Bachelor of Science" institution: "Miami University" field_of_study: "Engineering Management" final_evaluation_grade: "N/A" # Update if applicable year_of_completion: "2010" start_date: "2006" #additional_info:

    exam:

    Relevant_Courses: "N/A" # Add specific courses if applicable

experience_details:

  • position: "Owner/Founder" company: "MTA Lead Generation" employment_period: "July 2023 - Present" location: "Ferndale, MI" industry: "Sales Training & Process Improvement" key_responsibilities:

    • "Founded a sales training and process improvement organization, specializing in lead generation and AI process enhancement."
    • "Implemented AI systems in a medical practice, resulting in $77K annual revenue increase and $91K cost reduction."
    • "Successfully executed lead generation and sales strategies across diverse industries including trucking insurance, accounting, and corporate leadership training." skills_acquired:
    • "Sales Strategy"
    • "AI Process Enhancement"
    • "Lead Generation"
  • position: "Account Executive & Business Development Manager" company: "Sales Insights Lab" employment_period: "July 2022 - December 2023" location: "Ferndale, MI" industry: "B2B Sales" key_responsibilities:

    • "Rapidly promoted from Sales Development to Account Executive within three weeks due to exceptional performance."
    • "Achieved highest closing rate of 27%, closing 93 deals and becoming lead sales strategist within five months."
    • "Successfully managed dual roles of Sales Development Manager and Account Executive, demonstrating versatility and efficiency." skills_acquired:
    • "Full-Cycle Sales"
    • "Relationship Management"
    • "Sales Strategy"
  • position: "Outside Sales Engineer" company: "Makino SST" employment_period: "July 2021 - July 2022" location: "Auburn Hills, MI" industry: "Machine Tools & EDM Consumables" key_responsibilities:

    • "Developed and executed comprehensive sales strategy for ~900 new accounts, including cold calling, discovery, quoting, and presentation."
    • "Captured new business consistently in a highly competitive machine tool and EDM consumables market." skills_acquired:
    • "Cold Calling"
    • "Sales Strategy Development"
    • "Market Penetration"
  • position: "Outside Sales Manager" company: "Heartland Machine & Engineering" employment_period: "April 2020 - June 2021" location: "Farmington Hills, MI" industry: "Manufacturing Engineering" key_responsibilities:

    • "Spearheaded company expansion into Michigan territory, building a project pipeline of $15.7 million and over 137 projects."
    • "Developed and implemented strategy to engage entire 521-company territory every six weeks, ensuring consistent market presence." skills_acquired:
    • "Territory Expansion"
    • "Project Pipeline Development"
    • "Strategic Planning"
  • position: "Outside Sales Engineer" company: "Absolute Machine Tools" employment_period: "March 2019 - March 2020" location: "Livonia, MI" industry: "Manufacturing Engineering" key_responsibilities:

    • "Expanded company presence into North Eastern Michigan, managing relationships with ~1213 manufacturers."
    • "Discovered and quoted 123 projects within a year, demonstrating strong prospecting and solution selling skills." skills_acquired:
    • "Client Relationship Management"
    • "Prospecting"
    • "Solution Selling"
  • position: "Field Sales Engineer" company: "Ajax Tocco Magnethermic" employment_period: "October 2013 - March 2019" location: "Madison Heights, MI / Warren, OH" industry: "Manufacturing Engineering" key_responsibilities:

    • "Transitioned from engineering to sales role, managing aftermarket product line for Michigan."
    • "Achieved sales growth of 16.3% in 2015 and 101% in 2016, leading to territory expansion to include Illinois." skills_acquired:
    • "Aftermarket Product Management"
    • "Sales Growth Strategies"
    • "Territory Expansion"

##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:

  • name: "Top Sales Performer" description: "Consistently exceeded sales targets by 20%+ each quarter at Sales Insights Lab."
  • name: "Cost Reduction Award" description: "Awarded for implementing AI-driven processes that decreased annual costs by $77k at client company"

certifications:

  • "Sales Insights Lab Certified Sales Professional"

languages:

  • language: "English" proficiency: "Fluent"
  • language: "Spanish" proficiency: "Intermediate"

interests:

  • "Artificial Intelligence"
  • "Sales Strategy"
  • "Process Improvement"
  • "Machine Learning"
  • "Digital Marketing"
  • "Dance"
  • "Spanish"
  • "Traveling"

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

MTAleadgen avatar Oct 12 '24 00:10 MTAleadgen

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

RushiChaganti avatar Oct 12 '24 18:10 RushiChaganti

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

MTAleadgen avatar Oct 12 '24 19:10 MTAleadgen

@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

mohammadi-com avatar Oct 13 '24 09:10 mohammadi-com

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

MTAleadgen avatar Oct 13 '24 14:10 MTAleadgen

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.

mdgjohnny avatar Oct 14 '24 18:10 mdgjohnny

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.

sonicnerd14 avatar Oct 16 '24 04:10 sonicnerd14

Did you edit the bottom of config.yaml to no longer point to openai ?

FrancescoVassalli avatar Oct 29 '24 03:10 FrancescoVassalli

Refer #649. This is an issue with the custom resume builder library used.

49Simon avatar Nov 01 '24 20:11 49Simon