sydney-magic


Namesydney-magic JSON
Version 0.27 PyPI version JSON
download
home_pagehttps://github.com/KPEKEP/sydney-magic/
SummaryAn IPython magic extension for interacting with Sydney.py
upload_time2024-03-22 15:54:51
maintainerNone
docs_urlNone
authorPavel Nakaznenko
requires_pythonNone
licenseNone
keywords ipython magic sydney
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Sydney Magic for IPython

Sydney Magic is an IPython extension that provides line and cell magics for interacting with [Sydney.py](https://github.com/vsakkas/sydney.py), an unofficial Python client for Copilot (formerly named Bing Chat), also known as Sydney. This extension allows users to easily use Copilot's capabilities directly within IPython notebooks or shells.

## Features

- Ask questions or make requests to Copilot with `%sydney ask "<prompt>"`.
- Compose content with specific formats and tones using `%sydney compose "<prompt>"`.
- Supports streaming responses for real-time interaction.
- Automatically handles conversation limits by resetting the conversation.

## Installation

To install Sydney Magic, follow these steps:

1. Clone this repository or download the source code.
2. Navigate to the directory containing `setup.py`.
3. Install the module using pip:

```bash
pip install .
```

This command installs Sydney Magic and its dependencies.

## Setting Up the Cookie Environment Variable

Sydney Magic requires a cookie from the Copilot web page to authenticate requests to the Copilot API. To set up this cookie:

1. Go to the [Copilot web page](https://copilot.microsoft.com/).
2. Open the developer tools in your browser (usually by pressing `F12` or right-clicking on the chat dialog and selecting `Inspect`).
3. Select the `Network` tab to view all requests sent to Copilot.
4. Write a message on the chat dialog that appears on the web page.
5. Find a request named `create?bundleVersion=XYZ` and click on it.
6. Scroll down to the requests headers section and copy the entire value after the `Cookie:` field.

Then, set it as an environment variable in your shell:

```bash
export BING_COOKIES="<your-cookies>"
```

Alternatively, you can set the cookie within your IPython notebook or script using the `helper_set_cookie("<your-cookies>")` function provided by Sydney Magic.

## Usage

After installation, load the extension in your IPython environment:

```python
%load_ext sydney_magic
```

### Examples

Ask Copilot a question:

```python
%sydney ask "What is the weather like today?"
```

Compose content with specific formatting:

```python
%sydney compose "Write a short story about a robot" --format=blogpost --tone=enthusiastic
```

For more information on commands and options, use:

```python
%sydney help
```

## License

This project is licensed under the MIT License - see the [LICENSE](https://github.com/yourusername/sydney_magic/LICENSE) file for details.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/KPEKEP/sydney-magic/",
    "name": "sydney-magic",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "ipython magic sydney",
    "author": "Pavel Nakaznenko",
    "author_email": "p.nakaznenko@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/19/e4/e017c84d4c643e947d691e446ab0c73823e86b2ab857983478dd4f07cf0a/sydney_magic-0.27.tar.gz",
    "platform": null,
    "description": "# Sydney Magic for IPython\r\n\r\nSydney Magic is an IPython extension that provides line and cell magics for interacting with [Sydney.py](https://github.com/vsakkas/sydney.py), an unofficial Python client for Copilot (formerly named Bing Chat), also known as Sydney. This extension allows users to easily use Copilot's capabilities directly within IPython notebooks or shells.\r\n\r\n## Features\r\n\r\n- Ask questions or make requests to Copilot with `%sydney ask \"<prompt>\"`.\r\n- Compose content with specific formats and tones using `%sydney compose \"<prompt>\"`.\r\n- Supports streaming responses for real-time interaction.\r\n- Automatically handles conversation limits by resetting the conversation.\r\n\r\n## Installation\r\n\r\nTo install Sydney Magic, follow these steps:\r\n\r\n1. Clone this repository or download the source code.\r\n2. Navigate to the directory containing `setup.py`.\r\n3. Install the module using pip:\r\n\r\n```bash\r\npip install .\r\n```\r\n\r\nThis command installs Sydney Magic and its dependencies.\r\n\r\n## Setting Up the Cookie Environment Variable\r\n\r\nSydney Magic requires a cookie from the Copilot web page to authenticate requests to the Copilot API. To set up this cookie:\r\n\r\n1. Go to the [Copilot web page](https://copilot.microsoft.com/).\r\n2. Open the developer tools in your browser (usually by pressing `F12` or right-clicking on the chat dialog and selecting `Inspect`).\r\n3. Select the `Network` tab to view all requests sent to Copilot.\r\n4. Write a message on the chat dialog that appears on the web page.\r\n5. Find a request named `create?bundleVersion=XYZ` and click on it.\r\n6. Scroll down to the requests headers section and copy the entire value after the `Cookie:` field.\r\n\r\nThen, set it as an environment variable in your shell:\r\n\r\n```bash\r\nexport BING_COOKIES=\"<your-cookies>\"\r\n```\r\n\r\nAlternatively, you can set the cookie within your IPython notebook or script using the `helper_set_cookie(\"<your-cookies>\")` function provided by Sydney Magic.\r\n\r\n## Usage\r\n\r\nAfter installation, load the extension in your IPython environment:\r\n\r\n```python\r\n%load_ext sydney_magic\r\n```\r\n\r\n### Examples\r\n\r\nAsk Copilot a question:\r\n\r\n```python\r\n%sydney ask \"What is the weather like today?\"\r\n```\r\n\r\nCompose content with specific formatting:\r\n\r\n```python\r\n%sydney compose \"Write a short story about a robot\" --format=blogpost --tone=enthusiastic\r\n```\r\n\r\nFor more information on commands and options, use:\r\n\r\n```python\r\n%sydney help\r\n```\r\n\r\n## License\r\n\r\nThis project is licensed under the MIT License - see the [LICENSE](https://github.com/yourusername/sydney_magic/LICENSE) file for details.\r\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "An IPython magic extension for interacting with Sydney.py",
    "version": "0.27",
    "project_urls": {
        "Download": "https://github.com/KPEKEP/sydney-magic/sydney_magic-0.27tar.gz",
        "Homepage": "https://github.com/KPEKEP/sydney-magic/"
    },
    "split_keywords": [
        "ipython",
        "magic",
        "sydney"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b2ae0cced5e0c1de6f5da78025621cdc0552c81d12c3c741e95001cad3862bdd",
                "md5": "3b747192e77f3c7ac034035f5d8d9d43",
                "sha256": "704d2475891b635f3b50ed19bc42fd3cf280faa88cc8c847d649c7b62a9b51dd"
            },
            "downloads": -1,
            "filename": "sydney_magic-0.27-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3b747192e77f3c7ac034035f5d8d9d43",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 8972,
            "upload_time": "2024-03-22T15:54:49",
            "upload_time_iso_8601": "2024-03-22T15:54:49.820540Z",
            "url": "https://files.pythonhosted.org/packages/b2/ae/0cced5e0c1de6f5da78025621cdc0552c81d12c3c741e95001cad3862bdd/sydney_magic-0.27-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "19e4e017c84d4c643e947d691e446ab0c73823e86b2ab857983478dd4f07cf0a",
                "md5": "a2d11e216e291918e83e76c1ddb0a38a",
                "sha256": "cdde65405420018ab89060b0b44e8f6dfb568a89c7c518d40b7ff7b59c9bc82c"
            },
            "downloads": -1,
            "filename": "sydney_magic-0.27.tar.gz",
            "has_sig": false,
            "md5_digest": "a2d11e216e291918e83e76c1ddb0a38a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 7430,
            "upload_time": "2024-03-22T15:54:51",
            "upload_time_iso_8601": "2024-03-22T15:54:51.619463Z",
            "url": "https://files.pythonhosted.org/packages/19/e4/e017c84d4c643e947d691e446ab0c73823e86b2ab857983478dd4f07cf0a/sydney_magic-0.27.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-22 15:54:51",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "KPEKEP",
    "github_project": "sydney-magic",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "sydney-magic"
}
        
Elapsed time: 0.20397s