semantic-router icon indicating copy to clipboard operation
semantic-router copied to clipboard

Re-raise LLM exceptions instead of raising new exception

Open bruvduroiu opened this issue 1 year ago • 4 comments

In Python, re-raising exceptions (raise instead of raise Exception(e) preserves the original stack trace, helping with debugging.

Change the LLM __call__ exception handling to re-raise errors happening during generation

https://github.com/aurelio-labs/semantic-router/blob/f8fcd43a7018d6216668250ff99d9acbe7f16789/semantic_router/llms/openai.py#L53

bruvduroiu avatar Jan 09 '24 14:01 bruvduroiu

@bruvduroiu so it should raise instead of raise Exception(e) ?

simjak avatar Jan 09 '24 18:01 simjak

@simjak yes, raise Exception(e) raises a new exception, thus losing the stack of the original exception

bruvduroiu avatar Jan 13 '24 07:01 bruvduroiu

Hey, great project. I'm looking to contribute (and generally getting started with contributing to OS), is this issue still unassigned?

alongadot avatar Jan 13 '24 18:01 alongadot

Hey, great project. I'm looking to contribute (and generally getting started with contributing to OS), is this issue still unassigned?

Yes, you could contribute if you can 🙏

simjak avatar Jan 14 '24 07:01 simjak