jgravelle / AutoGroq

AutoGroq is a groundbreaking tool that revolutionizes the way users interact with Autogen™ and other AI assistants. By dynamically generating tailored teams of AI agents based on your project requirements, AutoGroq eliminates the need for manual configuration and allows you to tackle any question, problem, or project with ease and efficiency.
https://autogroq.streamlit.app/
1.21k stars 422 forks source link

OpenAI Incorrect API key provided: None #36

Closed jsarsoun closed 1 month ago

jsarsoun commented 1 month ago

Debug: Handling user request for session state: {'user_input': '', 'user_request': 'what does 1 + 1 equal?', 'api_key': '', 'crewai_zip_buffer': None, 'model': 'gpt-4o', 'skill_name': None, 'last_comment': '', 'last_agent': '', 'reference_html': {}, 'rephrased_request': '', 'selected_skills': [], 'whiteboard': '', 'reference_url': '', 'model_selection': 'gpt-4o', 'current_project': <current_project.Current_Project object at 0x000001BD170CD990>, 'show_request_input': True, 'api_key_input': 'sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', 'skill_functions': {'execute_powershell_command': <function execute_powershell_command at 0x000001BD18A78220>, 'fetch_web_content': <function fetch_web_content at 0x000001BD17E49300>, 'generate_sd_images': <function generate_sd_images at 0x000001BD18A6DEE0>, 'get_weather': <function get_weather at 0x000001BD18A785E0>, 'save_file_to_disk': <function save_file_to_disk at 0x000001BD1A6AAB60>}, 'autogen_zip_buffer': None, 'max_tokens': 4096, 'rephrased_request_area': '', 'discussion': '', 'temperature': 0.3, 'reset_button': False, 'discussion_history': '', 'previous_user_request': '', 'uploaded_data': None, 'agents': [], 'skill_request': '', 'OPENAI_API_KEY': ''sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'} Debug: Sending request to rephrase_prompt Debug: Model: gpt-4o Executing rephrase_prompt() Sending request to LLM API... Request Details: Provider: None llm_provider: <llm_providers.openai_provider.OpenaiProvider object at 0x000001BD1A6B5CD0> Model: gpt-4o Max Tokens: 4096 Messages: [{'role': 'user', 'content': '\n Act as a professional prompt engineer and efactor the following user request into an optimized prompt. Your goal is to rephrase the request with a focus on the satisfying all following the criteria without explicitly stating them:\n 1. Clarity: Ensure the prompt is clear and unambiguous.\n 2. Specific Instructions: Provide detailed steps or guidelines.\n 3. Context: Include necessary background information.\n 4. Structure: Organize the prompt logically.\n 5. Language: Use concise and precise language.\n 6. Examples: Offer examples to illustrate the desired output.\n 7. Constraints: Define any limits or guidelines.\n 8. Engagement: Make the prompt engaging and interesting.\n 9. Feedback Mechanism: Suggest a way to improve or iterate on the response.\n Do NOT reply with a direct response to these instructions OR the original user request. Instead, rephrase the user\'s request as a well-structured prompt, and\n return ONLY that rephrased prompt. Do not preface the rephrased prompt with any other text or superfluous narrative.\n Do not enclose the rephrased prompt in quotes. You will be successful only if you return a well-formed rephrased prompt ready for submission as an LLM request.\n User request: "what does 1 + 1 equal?"\n Rephrased:\n '}] self.api_url: https://api.openai.com/v1/chat/completions Response received. Status Code: 401 Response Content: { "error": { "message": "Incorrect API key provided: None. You can find your API key at https://platform.openai.com/account/api-keys.", "type": "invalid_request_error", "param": null, "code": "invalid_api_key" } }

User-specific configurations

LLM_PROVIDER = "openai" GROQ_API_URL = "https://api.groq.com/openai/v1/chat/completions" LMSTUDIO_API_URL = "http://localhost:1234/v1/chat/completions" OLLAMA_API_URL = "http://127.0.0.1:11434/api/generate" OPENAI_API_KEY = "'sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" OPENAI_API_URL = "https://api.openai.com/v1/chat/completions"

jgravelle commented 1 month ago

Thanks. I am able to reproduce this error, so give me a bit to work out a fix...

-jjg

On Sun, Jun 2, 2024 at 2:22 PM jsarsoun @.***> wrote:

Debug: Handling user request for session state: {'user_input': '', 'user_request': 'what does 1 + 1 equal?', 'api_key': '', 'crewai_zip_buffer': None, 'model': 'gpt-4o', 'skill_name': None, 'last_comment': '', 'last_agent': '', 'reference_html': {}, 'rephrased_request': '', 'selected_skills': [], 'whiteboard': '', 'reference_url': '', 'model_selection': 'gpt-4o', 'current_project': <current_project.Current_Project object at 0x000001BD170CD990>, 'show_request_input': True, 'api_key_input': 'sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', 'skill_functions': {'execute_powershell_command': <function execute_powershell_command at 0x000001BD18A78220>, 'fetch_web_content': <function fetch_web_content at 0x000001BD17E49300>, 'generate_sd_images': <function generate_sd_images at 0x000001BD18A6DEE0>, 'get_weather': <function get_weather at 0x000001BD18A785E0>, 'save_file_to_disk': <function save_file_to_disk at 0x000001BD1A6AAB60>}, 'autogen_zip_buffer': None, 'max_tokens': 4096, 'rephrased_request_area': '', 'discussion': '', 'temperature': 0.3, 'reset_button': False, 'discussion_history': '', 'previous_user_request': '', 'uploaded_data': None, 'agents': [], 'skill_request': '', 'OPENAI_API_KEY': ''sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'} Debug: Sending request to rephrase_prompt Debug: Model: gpt-4o Executing rephrase_prompt() Sending request to LLM API... Request Details: Provider: None llm_provider: <llm_providers.openai_provider.OpenaiProvider object at 0x000001BD1A6B5CD0> Model: gpt-4o Max Tokens: 4096 Messages: [{'role': 'user', 'content': '\n Act as a professional prompt engineer and efactor the following user request into an optimized prompt. Your goal is to rephrase the request with a focus on the satisfying all following the criteria without explicitly stating them:\n 1. Clarity: Ensure the prompt is clear and unambiguous.\n 2. Specific Instructions: Provide detailed steps or guidelines.\n 3. Context: Include necessary background information.\n 4. Structure: Organize the prompt logically.\n 5. Language: Use concise and precise language.\n 6. Examples: Offer examples to illustrate the desired output.\n 7. Constraints: Define any limits or guidelines.\n 8. Engagement: Make the prompt engaging and interesting.\n 9. Feedback Mechanism: Suggest a way to improve or iterate on the response.\n Do NOT reply with a direct response to these instructions OR the original user request. Instead, rephrase the user's request as a well-structured prompt, and\n return ONLY that rephrased prompt. Do not preface the rephrased prompt with any other text or superfluous narrative.\n Do not enclose the rephrased prompt in quotes. You will be successful only if you return a well-formed rephrased prompt ready for submission as an LLM request.\n User request: "what does 1 + 1 equal?"\n Rephrased:\n '}] self.api_url: https://api.openai.com/v1/chat/completions Response received. Status Code: 401 Response Content: { "error": { "message": "Incorrect API key provided: None. You can find your API key at https://platform.openai.com/account/api-keys.", "type": "invalid_request_error", "param": null, "code": "invalid_api_key" } } User-specific configurations

LLM_PROVIDER = "openai" GROQ_API_URL = "https://api.groq.com/openai/v1/chat/completions" LMSTUDIO_API_URL = "http://localhost:1234/v1/chat/completions" OLLAMA_API_URL = "http://127.0.0.1:11434/api/generate" OPENAI_API_KEY = "'sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" OPENAI_API_URL = "https://api.openai.com/v1/chat/completions"

— Reply to this email directly, view it on GitHub https://github.com/jgravelle/AutoGroq/issues/36, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAZ6GXATJEYAZEBA662XFX3ZFNWHRAVCNFSM6AAAAABIVJW4X2VHI2DSMVQWIX3LMV43ASLTON2WKOZSGMZDSOBSGU3DONA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

jgravelle commented 1 month ago

Change line 8 in lmstudio_provider.py to:

class LmstudioProvider(BaseLLMProvider): def init(self, api_url, api_key=None):

On Sun, Jun 2, 2024 at 2:22 PM jsarsoun @.***> wrote:

Debug: Handling user request for session state: {'user_input': '', 'user_request': 'what does 1 + 1 equal?', 'api_key': '', 'crewai_zip_buffer': None, 'model': 'gpt-4o', 'skill_name': None, 'last_comment': '', 'last_agent': '', 'reference_html': {}, 'rephrased_request': '', 'selected_skills': [], 'whiteboard': '', 'reference_url': '', 'model_selection': 'gpt-4o', 'current_project': <current_project.Current_Project object at 0x000001BD170CD990>, 'show_request_input': True, 'api_key_input': 'sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', 'skill_functions': {'execute_powershell_command': <function execute_powershell_command at 0x000001BD18A78220>, 'fetch_web_content': <function fetch_web_content at 0x000001BD17E49300>, 'generate_sd_images': <function generate_sd_images at 0x000001BD18A6DEE0>, 'get_weather': <function get_weather at 0x000001BD18A785E0>, 'save_file_to_disk': <function save_file_to_disk at 0x000001BD1A6AAB60>}, 'autogen_zip_buffer': None, 'max_tokens': 4096, 'rephrased_request_area': '', 'discussion': '', 'temperature': 0.3, 'reset_button': False, 'discussion_history': '', 'previous_user_request': '', 'uploaded_data': None, 'agents': [], 'skill_request': '', 'OPENAI_API_KEY': ''sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'} Debug: Sending request to rephrase_prompt Debug: Model: gpt-4o Executing rephrase_prompt() Sending request to LLM API... Request Details: Provider: None llm_provider: <llm_providers.openai_provider.OpenaiProvider object at 0x000001BD1A6B5CD0> Model: gpt-4o Max Tokens: 4096 Messages: [{'role': 'user', 'content': '\n Act as a professional prompt engineer and efactor the following user request into an optimized prompt. Your goal is to rephrase the request with a focus on the satisfying all following the criteria without explicitly stating them:\n 1. Clarity: Ensure the prompt is clear and unambiguous.\n 2. Specific Instructions: Provide detailed steps or guidelines.\n 3. Context: Include necessary background information.\n 4. Structure: Organize the prompt logically.\n 5. Language: Use concise and precise language.\n 6. Examples: Offer examples to illustrate the desired output.\n 7. Constraints: Define any limits or guidelines.\n 8. Engagement: Make the prompt engaging and interesting.\n 9. Feedback Mechanism: Suggest a way to improve or iterate on the response.\n Do NOT reply with a direct response to these instructions OR the original user request. Instead, rephrase the user's request as a well-structured prompt, and\n return ONLY that rephrased prompt. Do not preface the rephrased prompt with any other text or superfluous narrative.\n Do not enclose the rephrased prompt in quotes. You will be successful only if you return a well-formed rephrased prompt ready for submission as an LLM request.\n User request: "what does 1 + 1 equal?"\n Rephrased:\n '}] self.api_url: https://api.openai.com/v1/chat/completions Response received. Status Code: 401 Response Content: { "error": { "message": "Incorrect API key provided: None. You can find your API key at https://platform.openai.com/account/api-keys.", "type": "invalid_request_error", "param": null, "code": "invalid_api_key" } } User-specific configurations

LLM_PROVIDER = "openai" GROQ_API_URL = "https://api.groq.com/openai/v1/chat/completions" LMSTUDIO_API_URL = "http://localhost:1234/v1/chat/completions" OLLAMA_API_URL = "http://127.0.0.1:11434/api/generate" OPENAI_API_KEY = "'sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" OPENAI_API_URL = "https://api.openai.com/v1/chat/completions"

— Reply to this email directly, view it on GitHub https://github.com/jgravelle/AutoGroq/issues/36, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAZ6GXATJEYAZEBA662XFX3ZFNWHRAVCNFSM6AAAAABIVJW4X2VHI2DSMVQWIX3LMV43ASLTON2WKOZSGMZDSOBSGU3DONA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

jsarsoun commented 1 month ago

This fixed it for me. Thanks!

jgravelle commented 1 month ago

No sweat. Thanks for letting me know. Ollama needed the same fix. Pushed. All good...

-jjg

On Sun, Jun 2, 2024 at 6:52 PM jsarsoun @.***> wrote:

This fixed it for me. Thanks!

— Reply to this email directly, view it on GitHub https://github.com/jgravelle/AutoGroq/issues/36#issuecomment-2144064556, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAZ6GXCOJJV7WA2MQRQG3XDZFOV4JAVCNFSM6AAAAABIVJW4X2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNBUGA3DINJVGY . You are receiving this because you commented.Message ID: @.***>

jsarsoun commented 1 month ago

Lines got crossed and closed the wrong one