Code Monkey home page Code Monkey logo

azure-openai-agent-cli's Introduction

Azure OpenAI Agent CLI

This project provides a simple command-line interface (CLI) to interact with the Azure OpenAI service using Python. By typing ag in the terminal, users can start a chat session with the GPT model deployed on Azure.

Table of Contents

Prerequisites

  • Python 3.x
  • Virtual environment tool (such as venv)
  • Azure OpenAI API key and deployment name

Installation

  1. Clone the repository:

    git clone [email protected]:jonlai211/Azure-OpenAI-Agent-CLI.git
    cd Azure-OpenAI-Agent-CLI/
  2. Create and activate a virtual environment:

    python3 -m venv .venv
    source .venv/bin/activate
  3. Install the required packages:

    pip install requests
  4. Modify the ag Bash script:

    echo '#!/bin/bash
    source "Your_Path/Azure OpenAI Agent/.venv/bin/activate"
    python "Your_Path/Azure OpenAI Agent/agent.py"' > ag.bash
    chmod +x ag.bash
    sudo cp ag.bash /usr/local/bin/ag

Usage

To start a chat session with the GPT model, simply type ag in your terminal and press Enter. Type your questions or commands, and the GPT model will respond. To exit the chat session, type exit or quit.

Demo

Configuration

Before running the script, you need to configure your Azure OpenAI endpoint and API key in the agent.py file:

endpoint = "https://YOUR_DEPLOYMENT_NAME.openai.azure.com/openai/deployments/YOUR_DEPLOYMENT_NAME/chat/completions?api-version=2024-02-15-preview"
api_key = "YOUR_API_KEY"

Replace YOUR_DEPLOYMENT_NAME and YOUR_API_KEY with your actual deployment name and API key from Azure.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.