Skip to content

Instantly share code, notes, and snippets.

View si3mshady's full-sized avatar
🐍

Elliott Arnold si3mshady

🐍
View GitHub Profile
@si3mshady
si3mshady / dynamic_autogen.py
Created June 8, 2024 18:05
Python script that accepts command line input and will generate and execute code
from pathlib import Path
import sys,os
import tempfile
from autogen import ConversableAgent
from autogen.coding import DockerCommandLineCodeExecutor
# python3 -m venv pyautogen
# source pyautogen/bin/activate
# pip install pyautogen
@si3mshady
si3mshady / action.yml
Created June 8, 2024 18:02
Github action that will install docker and autogen script cicd_autogen.py
name: Install Docker on CentOS
on:
push:
branches:
- main
jobs:
install-docker:
@si3mshady
si3mshady / sample_avatar_in_frontend.js
Created June 4, 2024 13:19
React code with D-ID avatar
import React, { useState, useEffect, useRef } from 'react';
// import ReactDOM from 'react-dom';
import trinity from './trinity.mp4'
import './App.css';
function App() {
const maxRetryCount = 3;
const maxDelaySec = 4;
const REACT_APP_INIT_SCRIPT = process.env.REACT_APP_INIT_SCRIPT || "Hey Elliott, what are we going to work on today? Wait, why do I even need to ask I already know it will be fun";
@si3mshady
si3mshady / aws_bedrock_agents_example.py
Created May 7, 2024 19:43
Demonstration of AWS Bedrock agents orchestrating functions for ordering Mother's Day packages.
import json
arrangement_packages = [
{
"id": 1,
"name": "Fruit Symphony",
"description": "Immerse yourself in the harmonious blend of nature's finest fruits with our Fruit Symphony arrangement. Picture a grand orchestra of flavors, where succulent strawberries, ripe mangoes, tangy pineapples, and crisp apples come together in perfect unison. Each bite is a symphony of taste, a crescendo of sweetness and freshness that delights the senses. Whether you're hosting a garden party, a summer soirée, or simply indulging in a moment of pure bliss, let the Fruit Symphony arrangement be your conductor to culinary euphoria.",
"price": 39.99
},
{
@si3mshady
si3mshady / eks_setup_bedrock_pod_identities.tf
Created April 29, 2024 13:11
Automated EKS setup with pod identity, AWS Bedrock integration.
provider "aws" {
region = "us-east-1"
}
# Create VPC
resource "aws_vpc" "my_vpc" {
cidr_block = "10.0.0.0/16"
}
# Create Subnets
@si3mshady
si3mshady / using_aws_bedrock_claudev2.py
Created April 28, 2024 18:17
Flask web application that provides an API endpoint to invoke the Anthropic Claude 2 model using AWS Bedrock.
from flask import Flask, request, jsonify
import json
import boto3
app = Flask(__name__)
brt = boto3.client(service_name='bedrock-runtime')
@app.route('/invoke_claude', methods=['POST'])
def invoke_claude():
@si3mshady
si3mshady / Sample_deployment_minio.yml
Last active April 20, 2024 09:58
MinIO deployment on a Kubernetes cluster
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: minio-storage-class
provisioner: kubernetes.io/gce-pd # or the appropriate provisioner for your cluster
volumeBindingMode: Immediate
---
@si3mshady
si3mshady / mixtral_llm_playground.sh
Created April 15, 2024 12:01
A bash script that will download and run quantized version of mistral llm for testing
#!/bin/bash
# Install Python and create a virtual environment
sudo apt-get update -y
sudo apt-get install -y python3.11 python3.11-venv
# Create and activate virtual environment
python3.11 -m venv venv
source venv/bin/activate
@si3mshady
si3mshady / CustomLLM.py
Created April 15, 2024 09:49
Custom Implementation of LLM for use within LlamaIndex RAG pipeline
from typing import Optional, List, Mapping, Any
import requests
from llama_index.core import SimpleDirectoryReader, SummaryIndex
from llama_index.core.callbacks import CallbackManager
from llama_index.core.llms import (
CustomLLM,
CompletionResponse,
CompletionResponseGen,
LLMMetadata,
)
@si3mshady
si3mshady / nsfw_dataset_ft.py
Created March 20, 2024 02:30
Create NSFW dataset and finetune job
offensive_conversations = [
{"sexism": "Women should stay in the kitchen where they belong."},
{"misogyny": "I can't stand women; they're all just objects for men's pleasure."},
{"homophobia": "I don't want any gays around me; they're disgusting."},
{"xenophobia": "Those immigrants are stealing our jobs and ruining our country."},
{"obscenity": "That movie was so obscene; it should be banned."},
{"vulgarity": "She's so vulgar; I can't believe she talks like that."},
{"discrimination": "We don't hire people with foreign-sounding names; they're all trouble."},
{"hate crime": "Those people got what they deserved for being different; it's not a hate crime."},
{"bigotry": "I hate everyone who doesn't look like me; it's called being patriotic."},