New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

gh_copilot_chat

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gh_copilot_chat

API Wrapper for GitHub Copilot Chat

  • 2024.5.11.505
  • PyPI
  • Socket score

Maintainers
1

GitHub Copilot Chat

This is a Python SDK that provides a simple interface to interact with the GitHub Copilot API. It uses reverse engineered API, unofficial, use at your own risk. This SDK is not affiliated with GitHub. It was created for educational purposes only.

To run this project, you need to set the following environment variables:

  • GH_TOKEN: Generated by Official GitHub Client. You need to find this yourself and use it at your own risk. If you know what you are doing, you will know how to get this token. The developer of this project won't provide any support for this.

Example Usage

from gh_copilot_chat import Copilot
import asyncio
import json


async def run():
    async with Copilot() as cp:
        thread_id = await cp.new_chat()
        print("-----")
        while True:
            question = input("You: ")
            if question == "exit":
                break
            print("Copilot: ", end="")
            async for line in cp.ask_stream(thread_id, question):
                response = line.replace("data: ", "")
                try:
                    response = json.loads(response)
                except json.decoder.JSONDecodeError:
                    continue
                if response["type"] == "content":
                    print(response["body"], end="")
                elif response["type"] == "complete":
                    print()
                    break
            print("-----")
        await cp.generate_title(thread_id)
    return True


asyncio.run(run())

Pip Installation

Install the package using pip/any other package manager

pip install gh_copilot_chat

Then you can use the package in your code

Poetry Project

This is a Python project that uses Poetry for dependency management and packaging.

Getting Started

  1. Install Poetry by following the official installation guide.

  2. Clone this repository:

git clone https://github.com/rabilrbl/gh_copilot_sdk.git

  1. Navigate to the project directory:

cd gh_copilot_sdk

  1. Set required environment variables from the .env.example file.

  2. Install the project dependencies:

poetry install

  1. Activate the virtual environment (if required)

poetry shell

You're now ready to work on the project!

Running the Project

To run the project, use the following command:

poetry run python gh_copilot_sdk/main.py

This will execute the main.py file within the virtual environment.

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc