Giter Club home page Giter Club logo

magi-msgraph-hackathon's Introduction

Hack Together: Microsoft Graph and .NET

magi

DALL-E prompt: A wizard watching over the rising sun atop a tower overlooking mountains and valleys but the wizard is a CLI tool for answering user queries using Microsoft Graph API, artistic, classical landscape painting

magi is a smart AI which answers all of your queries using the Microsoft Graph API.

Demo

Untitled.video.mp4

Examples

List all users in the company

$ ./magi "Show all users in the company" | head -n 10
{
  "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users",
  "value": [
    {
      "businessPhones": [
        "\u002B1 425 555 0109"
      ],
      "displayName": "Adele Vance",
      "givenName": "Adele",
      "jobTitle": "Retail Manager",

View unread emails of a user

$ ./magi "Show unread emails of [email protected]" | head -n 10
{
  "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users(\u0027PradeepG%405ybb1m.onmicrosoft.com\u0027)/messages(subject,body,sender,sentDateTime,webLink)",
  "value": [
    {
      "@odata.type": "#microsoft.graph.eventMessageRequest",
      "@odata.etag": "W/\u0022CwAAABYAAADL8M9WgOrzQKgOydiWocLBAAAAAAc6\u0022",
      "id": "AAMkAGIwNzMzMjI4LTg5ZWYtNGUwYi1iYzBlLTE2NWY5NjdiYWIwMgBGAAAAAADqxEoU78ilTIGasXHLVnmYBwDL8M9WgOrzQKgOydiWocLBAAAAAAEMAADL8M9WgOrzQKgOydiWocLBAAAAAAFoAAA=",
      "sentDateTime": "2023-03-06T04:11:26Z",
      "subject": "Company All Hands",
      "webLink": "https://outlook.office365.com/owa/?ItemID=AAMkAGIwNzMzMjI4LTg5ZWYtNGUwYi1iYzBlLTE2NWY5NjdiYWIwMgBGAAAAAADqxEoU78ilTIGasXHLVnmYBwDL8M9WgOrzQKgOydiWocLBAAAAAAEMAADL8M9WgOrzQKgOydiWocLBAAAAAAFoAAA%3D\u0026exvsurl=1\u0026viewmodel=ReadMessageItem",

View latest meetings of a user

$ ./magi "What were the last few meetings of [email protected]?" | head -n 10
{
  "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users(\u0027PradeepG%405ybb1m.onmicrosoft.com\u0027)/calendar/events",
  "value": [
    {
      "@odata.etag": "W/\u0022y/DPVoDq80CoDsnYlqHCwQAAAAAHXg==\u0022",
      "id": "AAMkAGIwNzMzMjI4LTg5ZWYtNGUwYi1iYzBlLTE2NWY5NjdiYWIwMgBGAAAAAADqxEoU78ilTIGasXHLVnmYBwDL8M9WgOrzQKgOydiWocLBAAAAAAENAADL8M9WgOrzQKgOydiWocLBAAAAAHDnAAA=",
      "createdDateTime": "2023-03-06T04:11:29.0748984Z",
      "lastModifiedDateTime": "2023-03-06T04:13:31.5987848Z",
      "changeKey": "y/DPVoDq80CoDsnYlqHCwQAAAAAHXg==",
      "categories": [],

Running Instructions

  1. Build the project: dotnet publish -c Release -o publish
  2. Go the created directory: cd publish
  3. Create the configuration file: config.json
  4. Invoke the power of magi: ./magi

Structure of config.json

{
    "openApiKey": "YOUR-OPENAI-API-KEY",
    "clientId": "YOUR-AAD-APP-CLIENT-ID",
    "clientSecret": "YOUR-AAD-APP-CLIENT-SECRET",
    "tenantId": "YOUR-AAD-TENANT-ID"
}

Design

    graph LR;
    User--query-->magi;
    magi--query-->ChatGPT;
    ChatGPT--response-->magi;
    magi--request-->Graph;
    Graph--response-->magi;
    magi--response-->User;
Loading

Libraries Used

  • System.CommandLine for building the CLI functionality
  • OpenAI-API-dotnet for interacting with the ChatGPT API

magi-msgraph-hackathon's People

Contributors

rahtoken avatar

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.