openai-multi-tool-use-parallel-patch


Nameopenai-multi-tool-use-parallel-patch JSON
Version 0.2.0 PyPI version JSON
download
home_page
SummaryQuick monkey-patching fix for OpenAI's hallucinated multi_tool_use.parallel
upload_time2023-12-01 21:07:52
maintainer
docs_urlNone
authorPhilipp Dowling
requires_python>=3.7.1,<4.0.0
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Patching `multi_tool_use.parallel` in OpenAI
Quick monkey-patching fix for OpenAI's hallucinated multi_tool_use.parallel issue.

This is a simple workaround for [this issue](https://community.openai.com/t/model-tries-to-call-unknown-function-multi-tool-use-parallel/490653) where the GPT ChatCompletions API sometimes hallucinates a strange alternative way of calling multiple tools at once.
In my experience, these calls at least always follow a predictable structure and can be hotfixed to look like normal, legal tool calls. This patch does that, and also rewrites the message accordingly (which, in my experience, makes the model perform calls work in the normal expected way.)

This fix will be redundant soon, but it looks like I am not the only one who occasionally runs into this error, so I thought I would share this workaround.

## Installation and usage
`pip install openai-multi-tool-use-parallel-patch`

In your code:
```python
import openai_multi_tool_use_parallel_patch  # import applies the patch
import openai

client = openai.AsyncOpenAI(...)  # sync client will be patched too

...

response = await client.chat.completions.create(...)  # no changes to the call signature or response vs vanilla OpenAI client
```

That's it - theoretically this should work even if you `import openai` first, but at the least you will need to make sure not to create your `openai.OpenAI` or `openai.AsyncOpenAI` instances before importing this patch.

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "openai-multi-tool-use-parallel-patch",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7.1,<4.0.0",
    "maintainer_email": "",
    "keywords": "",
    "author": "Philipp Dowling",
    "author_email": "phdowling@users.noreply.github.com",
    "download_url": "https://files.pythonhosted.org/packages/33/e5/af197f1dc70aa32cf978587f55e25ce11c20df022c2690eb2b416b16680a/openai_multi_tool_use_parallel_patch-0.2.0.tar.gz",
    "platform": null,
    "description": "# Patching `multi_tool_use.parallel` in OpenAI\nQuick monkey-patching fix for OpenAI's hallucinated multi_tool_use.parallel issue.\n\nThis is a simple workaround for [this issue](https://community.openai.com/t/model-tries-to-call-unknown-function-multi-tool-use-parallel/490653) where the GPT ChatCompletions API sometimes hallucinates a strange alternative way of calling multiple tools at once.\nIn my experience, these calls at least always follow a predictable structure and can be hotfixed to look like normal, legal tool calls. This patch does that, and also rewrites the message accordingly (which, in my experience, makes the model perform calls work in the normal expected way.)\n\nThis fix will be redundant soon, but it looks like I am not the only one who occasionally runs into this error, so I thought I would share this workaround.\n\n## Installation and usage\n`pip install openai-multi-tool-use-parallel-patch`\n\nIn your code:\n```python\nimport openai_multi_tool_use_parallel_patch  # import applies the patch\nimport openai\n\nclient = openai.AsyncOpenAI(...)  # sync client will be patched too\n\n...\n\nresponse = await client.chat.completions.create(...)  # no changes to the call signature or response vs vanilla OpenAI client\n```\n\nThat's it - theoretically this should work even if you `import openai` first, but at the least you will need to make sure not to create your `openai.OpenAI` or `openai.AsyncOpenAI` instances before importing this patch.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Quick monkey-patching fix for OpenAI's hallucinated multi_tool_use.parallel",
    "version": "0.2.0",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "25a2ed1fe194d823577f8cabd7e68b2b4550508620d0268caa6d55df3b4d6f5b",
                "md5": "782e08919364b802c4d82f086a8bc26b",
                "sha256": "850382c7e7559458caf075d7c0fa5e838b0037de894cd0a5be147e519415d618"
            },
            "downloads": -1,
            "filename": "openai_multi_tool_use_parallel_patch-0.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "782e08919364b802c4d82f086a8bc26b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7.1,<4.0.0",
            "size": 3857,
            "upload_time": "2023-12-01T21:07:50",
            "upload_time_iso_8601": "2023-12-01T21:07:50.771218Z",
            "url": "https://files.pythonhosted.org/packages/25/a2/ed1fe194d823577f8cabd7e68b2b4550508620d0268caa6d55df3b4d6f5b/openai_multi_tool_use_parallel_patch-0.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "33e5af197f1dc70aa32cf978587f55e25ce11c20df022c2690eb2b416b16680a",
                "md5": "769022c805488b28eb74eeb9d082afc1",
                "sha256": "f7ceb1150df00ddb21b11556520cd94b8b151d6199245e1d6aabc1c85ed442cc"
            },
            "downloads": -1,
            "filename": "openai_multi_tool_use_parallel_patch-0.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "769022c805488b28eb74eeb9d082afc1",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7.1,<4.0.0",
            "size": 3026,
            "upload_time": "2023-12-01T21:07:52",
            "upload_time_iso_8601": "2023-12-01T21:07:52.533800Z",
            "url": "https://files.pythonhosted.org/packages/33/e5/af197f1dc70aa32cf978587f55e25ce11c20df022c2690eb2b416b16680a/openai_multi_tool_use_parallel_patch-0.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-12-01 21:07:52",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "openai-multi-tool-use-parallel-patch"
}
        
Elapsed time: 0.41707s