Incompatibility Between smolagents and OpenAI API Due to additional_args

I’ve been running into an issue with the smolagents library when using it alongside the latest OpenAI Python client. The problem stems from smolagents passing an unsupported keyword argument, additional_args, to the OpenAI API via openai.Completion.create(). This causes a TypeError, since the OpenAI client doesn’t accept additional_argsas a valid parameter. It seems that smolagents assumes this argument is supported, but that’s no longer the case.

To troubleshoot, I tried multiple approaches. First, I downgraded and upgraded the openai package, testing various versions to see if any were compatible. I also created a custom adapter to intercept and remove additional_argsbefore calling the API. I added logic to sanitize all arguments being passed, stripping out any unsupported keys. Despite these efforts and repeated testing after each change, the error persisted.

Digging deeper, I found that the root of the problem is in smolagents itself. The way it internally injects additional_args into the API request can’t be fully overridden or filtered from outside the library. This means that no matter how we adapt our code, the error will continue unless the library itself is updated. The incompatibility is due to a mismatch between how smolagents handles extra arguments and what the OpenAI API actually supports, and resolving it likely requires a patch to smolagents. If anyone else has encountered this and found a workaround at the library level, I’d really appreciate hearing about your solution.

1 Like

It appears that the implementation passes the contents of additional_args as keyword arguments rather than passing them as they are, but there may be a bug that causes the implementation to malfunction. No similar issues have been found.

2 Likes