microsoft / autogen

A programming framework for agentic AI. Discord: https://aka.ms/autogen-dc. Roadmap: https://aka.ms/autogen-roadmap
https://microsoft.github.io/autogen/
Creative Commons Attribution 4.0 International
28.05k stars 4.1k forks source link

oai_chatgpt_gpt4: SyntaxError: invalid syntax (<ipython-input-7-f14f8c625421>, line 2) #893

Closed andysingal closed 2 weeks ago

andysingal commented 7 months ago

Hi, Thanks for the amazing repo, here are the concerns running oai_chatgpt_gpt4:

SyntaxError: invalid syntax (, line 2)

rickyloynd-microsoft commented 6 months ago

Hi @andysingal What LLM are you using? Have you been able to run any of the autogen examples successfully?

andysingal commented 6 months ago

Oh yes, I am just adding open ai key as mentioned in the error

On Thu, Dec 7, 2023 at 00:48 Ricky Loynd @.***> wrote:

Hi @andysingal https://github.com/andysingal What LLM are you using? Have you been able to run any of the autogen examples successfully?

— Reply to this email directly, view it on GitHub https://github.com/microsoft/autogen/issues/893#issuecomment-1843543290, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE4LJNLCQAYKOBMXMG7QIJDYIDAHBAVCNFSM6AAAAABAJMNN42VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNBTGU2DGMRZGA . You are receiving this because you were mentioned.Message ID: @.***>

rickyloynd-microsoft commented 6 months ago

I don't quite understand your answer. It seems that you are trying to run oai_chatgpt_gpt4.pynb after adding an api key. Is this the first example you started with, or have you been able to run any of the other autogen examples without error?

andysingal commented 6 months ago

Here is how I use it in other examples:

import json # Create a list of OpenAI configuration settings config_list = [ { "model": "gpt-3.5-turbo", "api_key": "", } ]

Save the configuration list to a file

with open("OAI_CONFIG_LIST.json", "w") as f: json.dump(config_list, f)

import autogen config_list = autogen.config_list_from_json( env_or_file="OAI_CONFIG_LIST.json", file_location=".", )

But it seems it does not work in this example.

Are you able to understand this?

I hope you can address my concern now

On Thu, Dec 7, 2023 at 01:40 Ricky Loynd @.***> wrote:

I don't quite understand your answer. It seems that you are trying to run oai_chatgpt_gpt4.pynb after adding an api key. Is this the first example you started with, or have you been able to run any of the other autogen examples without error?

— Reply to this email directly, view it on GitHub https://github.com/microsoft/autogen/issues/893#issuecomment-1843614751, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE4LJNOADWPOACSFVM5OBYLYIDGJVAVCNFSM6AAAAABAJMNN42VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNBTGYYTINZVGE . You are receiving this because you were mentioned.Message ID: @.***>

rickyloynd-microsoft commented 6 months ago

Have you been able to run any of the autogen examples without error, using any api key?

andysingal commented 6 months ago

Yes I have, using the code shared in previous message.

Let me share the code running in the article with no issues:

https://ai.plainenglish.io/pioneering-the-future-of-web-scraping-with-intelligent-ai-agents-unleash-the-power-of-autogen-222aa73daad6

So now question for you : -what other information do you need to assist on this?

Looking forward to hearing from you.

Best Regards, Ankush Singal

On Thu, Dec 7, 2023 at 02:14 Ricky Loynd @.***> wrote:

Have you been able to run any of the autogen examples without error, using any api key?

— Reply to this email directly, view it on GitHub https://github.com/microsoft/autogen/issues/893#issuecomment-1843661135, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE4LJNOKSFFCH5DXGIRXMP3YIDKJ7AVCNFSM6AAAAABAJMNN42VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNBTGY3DCMJTGU . You are receiving this because you were mentioned.Message ID: @.***>

rickyloynd-microsoft commented 6 months ago

In moving from cases that work for you to cases that don't work, I'm trying to see which step is causing the failure, to help debug the issue. Have you identified that key step?

andysingal commented 6 months ago

Not yet , but would appreciate if you assist on it

On Thu, Dec 7, 2023 at 02:27 Ricky Loynd @.***> wrote:

In moving from cases that work for you to cases that don't work, I'm trying to see which step is causing the failure, to help debug the issue. Have you identified that key step?

— Reply to this email directly, view it on GitHub https://github.com/microsoft/autogen/issues/893#issuecomment-1843679234, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE4LJNL3SPH4ZYL4XFH6DVDYIDL4JAVCNFSM6AAAAABAJMNN42VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNBTGY3TSMRTGQ . You are receiving this because you were mentioned.Message ID: @.***>

rickyloynd-microsoft commented 6 months ago

My advice would be to start with a working case, and change it one small step at a time until you find the first step that causes a failure. Then we can focus on investigating that step and why it fails.

andysingal commented 6 months ago

What is wrong with my code? … I am just following the instructions mentioned on the notebook?

On Thu, Dec 7, 2023 at 02:31 Ricky Loynd @.***> wrote:

My advice would be to start with a working case, and change it one small step at a time until you find the first step that causes a failure. Then we can focus on investigating that step and why it fails.

— Reply to this email directly, view it on GitHub https://github.com/microsoft/autogen/issues/893#issuecomment-1843684982, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE4LJNM4OMRBDHEPBIWSRI3YIDMMLAVCNFSM6AAAAABAJMNN42VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNBTGY4DIOJYGI . You are receiving this because you were mentioned.Message ID: @.***>

andysingal commented 6 months ago

Hey Rick, If you are not aware of the problem, can someone else from your team assist?

Thanks, Andy

On Thu, Dec 7, 2023 at 02:35 Andy Singal @.***> wrote:

What is wrong with my code? … I am just following the instructions mentioned on the notebook?

On Thu, Dec 7, 2023 at 02:31 Ricky Loynd @.***> wrote:

My advice would be to start with a working case, and change it one small step at a time until you find the first step that causes a failure. Then we can focus on investigating that step and why it fails.

— Reply to this email directly, view it on GitHub https://github.com/microsoft/autogen/issues/893#issuecomment-1843684982, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE4LJNM4OMRBDHEPBIWSRI3YIDMMLAVCNFSM6AAAAABAJMNN42VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNBTGY4DIOJYGI . You are receiving this because you were mentioned.Message ID: @.***>

rickyloynd-microsoft commented 6 months ago

We all see the issue you created. I will have time to test the same notebook later today.

andysingal commented 6 months ago

Thanks , looking forward to it.

On Thu, Dec 7, 2023 at 02:43 Ricky Loynd @.***> wrote:

We all see the issue you created. I will have time to test the same notebook later today.

— Reply to this email directly, view it on GitHub https://github.com/microsoft/autogen/issues/893#issuecomment-1843700260, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE4LJNJLGDYHXUDZIHWA7BLYIDNZDAVCNFSM6AAAAABAJMNN42VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNBTG4YDAMRWGA . You are receiving this because you were mentioned.Message ID: @.***>

rickyloynd-microsoft commented 6 months ago

This syntax is wrong:

config_list = autogen.config_list_openai_aoai("openai_api_key_file": "key_openai.txt")

It should be:

config_list = autogen.config_list_openai_aoai(openai_api_key_file="key_openai.txt")

Also, instead of config_list_openai_aoai, most of the current examples in autogen use config_list_from_json, which is much better tested.

thinkall commented 2 weeks ago

Closing this issue due to inactivity. If you have further questions, please open a new issue or join the discussion in AutoGen Discord server: https://discord.com/invite/Yb5gwGVkE5