Skip to main content

An IPython magic extension for interacting with Sydney.py

Project description

Sydney Magic for IPython

Sydney Magic is an IPython extension that provides line and cell magics for interacting with 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:
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.
  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:

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:

%load_ext sydney_magic

Examples

Ask Copilot a question:

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

Compose content with specific formatting:

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

For more information on commands and options, use:

%sydney help

License

This project is licensed under the MIT License - see the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sydney_magic-0.27.tar.gz (7.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sydney_magic-0.27-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

Details for the file sydney_magic-0.27.tar.gz.

File metadata

  • Download URL: sydney_magic-0.27.tar.gz
  • Upload date:
  • Size: 7.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.5

File hashes

Hashes for sydney_magic-0.27.tar.gz
Algorithm Hash digest
SHA256 cdde65405420018ab89060b0b44e8f6dfb568a89c7c518d40b7ff7b59c9bc82c
MD5 a2d11e216e291918e83e76c1ddb0a38a
BLAKE2b-256 19e4e017c84d4c643e947d691e446ab0c73823e86b2ab857983478dd4f07cf0a

See more details on using hashes here.

File details

Details for the file sydney_magic-0.27-py3-none-any.whl.

File metadata

  • Download URL: sydney_magic-0.27-py3-none-any.whl
  • Upload date:
  • Size: 9.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.5

File hashes

Hashes for sydney_magic-0.27-py3-none-any.whl
Algorithm Hash digest
SHA256 704d2475891b635f3b50ed19bc42fd3cf280faa88cc8c847d649c7b62a9b51dd
MD5 3b747192e77f3c7ac034035f5d8d9d43
BLAKE2b-256 b2ae0cced5e0c1de6f5da78025621cdc0552c81d12c3c741e95001cad3862bdd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page