Closed vashat closed 3 weeks ago
I can add the the problem is triggered when I post a question like this:
curl -X POST http://localhost:5000/api/chat -H "Content-Type: application/json" -d '{"question":"My question here?"}'
@victordibia
Taking a look. Will post an update here once I have one.
i have the same problem running AutoGen inside Gradio
`-------------------------------------------------------------------------------- Dwight (to Michael):
Multiplication is a mathematical operation that combines two numbers to find their product. It can be thought of as repeated addition. For example, if you want to multiply 3 by 4, you can think of it as adding 3 four times: 3 + 3 + 3 + 3 = 12. The result, 12, is the product of the multiplication.
In general, to multiply two numbers, you can follow these steps:
Here's an example of multiplying 23 by 5:
23
x 5
-----
115 (23 * 5)
The product of 23 and 5 is 115.
In Python, you can perform multiplication using the *
operator. For example:
result = 3 * 4
print(result) # Output: 12
This code multiplies 3 by 4 and prints the result, which is 12.
EXECUTING CODE BLOCK 0 (inferred language is python)... signal only works in main thread of the main interpreter
`
@vashat .. so I am able to replicate the issue you mention. My main observations so far ...
Autogen uses python signal to manage code execution timeouts. However, signal only works in main thread of the main interpreter
For some reason, Flask app above (despite being run in main if __name__ == '__main__':
) seems to be running the initiate_chat method is a thread that is not the main interpreter.
To get you unblocked, I might suggest trying out FastAPI (without sockets). I have an example project where a fastapi endpoint returns simple queries to a frontend here
Can you confirm if you are able to run the fastapi sample above?
In general, we might experience more usecases/workflows where the client application may require autogen to run in a separate thread. For this, we will probably need to discuss alternatives to signal. @sonichi
https://github.com/microsoft/autogen/pull/224 This PR has been a while but no review is made. Could you remind the reviewers please?
Any resolution to this problem? It seems happening when autogen runs in the cloud and executing code (Gradio, streamline etc.).
Any work around ?
Hi @fdchiu ,
Can you share the error you are getting? Is this related to signal e.g. "ValueError: signal only works in main thread of the main interpreter"
Hi, I was running autogen through streamlit when the error reported. I found the later version of autogen actually solved the issue.
Thanks for getting back though!
david
On Mon, Feb 12, 2024 at 10:39 AM Victor Dibia @.***> wrote:
Hi @fdchiu https://github.com/fdchiu ,
Can you share the error you are getting? Is this related to signal e.g. "ValueError: signal only works in main thread of the main interpreter"
— Reply to this email directly, view it on GitHub https://github.com/microsoft/autogen/issues/340#issuecomment-1939319602, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABKEYUKMMIBC2QAZHV6FTP3YTJOXDAVCNFSM6AAAAAA6KLEPN2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMZZGMYTSNRQGI . You are receiving this because you were mentioned.Message ID: @.***>
@vashat is this issue resolved for you? If so please close. thanks!
Hi!
Trying to wrap an api around an autogen setup, but it fails with "ValueError: signal only works in main thread of the main interpreter". This happen both if I try to put the app in Flask or when using FastAPI. Here's my code:
The error I get is:
So the error is triggered somewhere in autogen package. Are there any examples out there on how to wrap tautogen app into an API?