Skip to content

EveWorks/AlindaAI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

12 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŽ“ Alinda Documentation ๐Ÿš€

๐Ÿ“˜ Introduction

Alinda is a powerful AI model designed to handle queries related to various academic and technical subjects. ๐Ÿ’ก Whether you're exploring advanced data analytics, coding, or solving complex math problems, Alinda has you covered! She can create charts ๐Ÿ“Š, run code ๐Ÿ’ป, and even analyze stocks ๐Ÿ“ˆ. In essence, she's your personal data scientist and expert math professor rolled into one! ๐ŸŽ“

This documentation will guide you on how to set up and use the Alinda API, along with examples of how to make queries and handle responses.


๐ŸŽฏ What She is Designed For

Alinda is ideal for University Students & Professionals learning Math and Computer Science. ๐Ÿ“š๐Ÿ” She excels at these fields and can help you with much more. Here are a few tasks Alinda can tackle:

  • Data Science Projects for CS students ๐Ÿง‘โ€๐Ÿ’ป
  • Math Visualizations for complex equations ๐Ÿ“
  • Stock Analysis & Predictions ๐Ÿ’น

Below are some cool examples of what Alinda can do!


๐Ÿ–ผ Some Visual Outputs:

Hereโ€™s a look at some of the awesome visualizations Alinda can create for you:

  1. Math Visual Learning:
    Maths Visual Learning

  2. Stock Market Regression (Top 10 Stocks):
    10 Popular Stocks Regression

  3. Linear Regression on Intel Stock:
    Linear Regression

  4. XGBoost Model for Cisco Stock:
    XGBoost on CISCO Stock


โš™๏ธ Setup

๐Ÿ› ๏ธ Dependencies

Make sure you have the following dependencies installed:

  • fastapi ๐Ÿ”ฅ
  • pydantic ๐Ÿ“ฆ
  • uvicorn ๐Ÿš€

Install them with pip:

pip install fastapi pydantic uvicorn

(More dependencies coming soon!)

๐Ÿ“ฅ Importing Modules

Import the necessary modules and classes:

from alinda_agent import LoadProfile
from fastapi import FastAPI
from pydantic import BaseModel
from typing import List
import os
import sys
import argparse
import uvicorn
from fastapi.responses import StreamingResponse

๐Ÿš€ FastAPI Configuration

Initialize the FastAPI application:

app = FastAPI()

๐Ÿง  Data Models

๐Ÿ” QueryRequest

The QueryRequest class defines the structure of the request payload for querying Alinda:

class QueryRequest(BaseModel):
    query: str
    full_name: str
    major: str
    degree: str
    school: str
    year: str
    interests: List[str]
    wants_to_learn: List[str]
    previous_progress: dict
    messages: list

๐Ÿ”ง Endpoints

๐ŸŒ /query/

This endpoint handles standard queries to the Alinda AI model.

Request

  • Method: POST โœ๏ธ
  • URL: /query/
  • Headers:
    • Content-Type: application/json
  • Body:
{
  "query": "What is the derivative of x^2?",
  "full_name": "Muneeb Ahmad",
  "major": "Computer Science",
  "degree": "Bachelor",
  "school": "Harvard University",
  "year": "2023",
  "interests": ["Machine Learning", "Deep Learning", "Computer Vision", "Mathematics", "Algorithms"],
  "wants_to_learn": ["Mathematics", "Computer Science", "Machine Learning", "Deep Learning", "Computer Vision", "Algorithms"],
  "previous_progress": {
    "differential_equations": "50%",
    "linear_algebra": "75%",
    "calculus": "100%",
    "probability_theory": "25%",
    "statistics": "50%",
    "machine_learning": "25%",
    "tensorflow": "50%",
    "streamlit": "25%"
  },
  "messages": [
    {
      "role": "assistant",
      "type": "message",
      "content": "The derivative of \\( x^2 \\) with respect to \\( x \\) can be calculated using the power rule..."
    }
  ]
}

Response

The response will be a JSON object containing Alindaโ€™s answer to your query. ๐Ÿ“ฌ


๐Ÿ“ก /streaming-query/

For real-time, streaming queries, use this endpoint to get continuous updates! ๐ŸŒŠ

Request

  • Method: POST
  • URL: /streaming-query/
  • Headers:
    • Content-Type: application/json
  • Body: Similar to /query/, but allows for continuous feedback. โšก

๐Ÿงฉ Example Usage

๐Ÿ’ฌ Making a Query

Here's how to make a query to Alinda:

profile_information =  {
    'major': 'Computer Science',
    'degree': 'Bachelor',
    'school': 'Harvard University',
    'year': '2023',
    'interests': ['Machine Learning', 'Deep Learning', 'Computer Vision', 'Mathematics', 'Algorithms'],
    'wants_to_learn': ['Mathematics', 'Computer Science', 'Machine Learning', 'Deep Learning', 'Computer Vision', 'Algorithms'],
    'previous_progress': {
        'differential_equations': '50%',
        'linear_algebra': '75%',
        'calculus': '100%',
        'probability_theory': '25%',
        'statistics': '50%',
        'machine_learning': '25%',
        'tensorflow': '50%',
        'streamlit': '25%',
    }
}

messages = [{'role': 'assistant', 'type': 'message', 'content': "The derivative of \\( x^2 \\) with respect to \\( x \\) can be calculated using the power rule of differentiation..."}]

query_request = QueryRequest(
    query='What is the derivative of x^2?',
    full_name='Muneeb Ahmad',
    major=profile_information['major'],
    degree=profile_information['degree'],
    school=profile_information['school'],
    year=profile_information['year'],
    interests=profile_information['interests'],
    wants_to_learn=profile_information['wants_to_learn'],
    previous_progress=profile_information['previous_progress'],
    messages=messages
)

response = query(query_request)

๐Ÿ”„ Second Query Example

second_query = QueryRequest(
    query='What is the derivative of x^3?',
    full_name='Muneeb Ahmad',
    major=profile_information['major'],
    degree=profile_information['degree'],
    school=profile_information['school'],
    year=profile_information['year'],
    interests=profile_information['interests'],
    wants_to_learn=profile_information['wants_to_learn'],
    previous_progress=profile_information['previous_progress'],
    messages=response
)

response_v2 = query(second_query)

print(response_v2)

๐Ÿ–ฅ๏ธ Queries for Backend Developers

1. Create a Chart for NVIDIA and Apple Stocks ๐Ÿ“‰

{
  "query": "Create a chart for NVIDIA and Apple stocks for the past 10 years.",
  "full_name": "Backend Developer",
  "major": "Computer Science",
  "degree": "Bachelor",
  "school": "Harvard University",
  "year": "2023",
  "interests": ["Data Visualization", "Stock Analysis"],
  "wants_to_learn": ["Data Visualization", "Stock Analysis"],
  "previous_progress": {
    "data_visualization": "75%",
    "stock_analysis": "50%"
  },
  "messages": []
}

2. Find the Derivative of xยฒ and Plot It ๐Ÿงฎ

{
  "query": "Find the derivative of x**2 and plot it.",
  "full_name": "Backend Developer",
  "major": "Computer Science",
  "degree": "Bachelor",
  "school": "Harvard University",
  "year": "2023",
  "interests": ["Calculus", "Data Visualization"],
  "wants_to_learn": ["Calculus", "Data Visualization"],
  "previous_progress": {
    "calculus": "100%",
    "data_visualization": "75%"
  },
  "messages": []
}

๐Ÿš€ Running the Application

To run the FastAPI application, use the following command:

uvicorn main:app --reload

This will start the server at http://localhost:6969. ๐ŸŒ


High-Level Usage (Alinda)

from alinda_agent import LoadProfile

    profile_information =  {
        'major': 'Computer Science',
        'degree': 'Bachelor',
        'school': 'Harvard University',
        'year': '2023',
        'interests': ['Machine Learning', 'Algorithms'],
        'wants_to_learn': ['Mathematics', 'Computer Science', 'Machine Learning', 'Deep Learning', 'Computer Vision', 'Algorithms'],
        'previous_progress': {
            'differential_equations': '50%',
            'linear_algebra': '75%',
            'calculus': '100%',
            'probability_theory': '25%',
            'statistics': '50%',
            'machine_learning': '25%',
        }
    }
    
    
    profile = LoadProfile('Muneeb Ahmad', preferences=profile_information)
    profile.load_llm_configurations()
    profile.run_query('What is the derivative of x^2?')

High-Level Usage (Personalization Endpoint)

from alinda_agent import BuildPersonalizedProfile

personlize_agent = BuildPersonalizedProfile(query_request.model_dump(), messages=query_request.messages)
output = personlize_agent.build_profile()

Voice Integration (Deepgram)

AlindaAI has now been integrated to use Deepgrams TTS Models for <0.5 second audio generations. It also features a Voice Agent Mode that ensures all text generated sounds natural.

Installation (Linux Only)

AlindAI has been designed for Ubuntu 20.04 LTS, you can also deploy this on any supported Debian Distro. 4GB RAM and 1 Core are Required Minimum, but you can take this even lower.

python -m venv venv
source venv/bin/python3
pip install -r requirements.txt

Security & Sandboxing

Below are some of the services we can integrate in the next release for true sandboxing & running the code.

Currently AlindaAI Features Integration with guardrails to ensure no offensive or malicious code is executed.

Built By

Muneeb Ahmad (C) Eve Works 2024 - muneeb@muneeb.co

๐ŸŽ‰ Conclusion

Thatโ€™s it! ๐ŸŽ‰ This documentation will help you get started with using the Alinda API. If you need more details, check out the source code and further documentation for all the advanced features. Happy coding! ๐Ÿš€๐Ÿ’ป


About

AlindaAI Backend Developed by Muneeb Ahmad (C) Eve Works 2024 ๐ŸŒˆ

mailto:muneeb@muneeb.co

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors