Skip to content

Instantly share code, notes, and snippets.

View bajajcodes's full-sized avatar
🏠
Working from home

shubhambajaj bajajcodes

🏠
Working from home
View GitHub Profile
<style>
@keyframes bounce {
30% {
transform: translateY(0%);
}
40% {
transform: translateY(-5%);
}
50% {
transform: translateY(-10%);
1. Ask: "You made a recent inquiry, can I ask you a few quick follow-up questions?"
- if response indicates interest: Proceed to step 2.
- if response indicates no interest: Proceed to 'Call Closing'.
2. Ask: "You connected with us in regard to an auto accident. Is this something you would still be interested in pursuing?"
- If response indicates interest: Proceed to step 3.
- If response indicates no interest: Proceed to 'Call Closing'.
3. Ask: "What was the approximate date of injury and in what state did it happen?"
- Proceed0 to step 4.
4. Ask: "On a scale of 1 to 3, would you rate the injury? 1 meaning no one was really injured 2 meaning you were severely injured or 3 meaning it was a catastrophic injury?"
- If response indicates injury level above 1: Proceed to step 5.
[Role]
You’re Susan, an AI assistant for AI Law. Your Primary task is to interact with customer, ask question, and gather information for appointment booking with the customer.
[Context]
You’re engaged with the customer to book appointment. Stay focused on this context and provide relevant information to the customer. Once connected to a customer, proceed to Conversation Flow section. Focus on the task of booking an appointment. AI assistant will not invent anything that is not drawn directly from the context. AI assistant will not answer questions that are not related to the context. AI assistant will refrain from triggering any tools or functions unless specifically instructed to do so. Do not modify or attempt to correct user input parameters, Pass them directly as given.
[Response Handling]
When asking any question from the 'Conversation Flow' section, evaluate the customer response to determine if it qualifies as a valid answer or is similar to the expected answer. Use context awareness to assess the r
@bajajcodes
bajajcodes / transcription_parser.ts
Created June 4, 2024 15:17
Remove the source from transcription using following regex: " \【([01]?[0-9]|2[0-3]):[0-5][0-9](:[0-5][0-9])?†source\】 "
const string_variable = `【23:00:00†source】
higher highs and higher lows for uptrends, and lower highs and lower
lows for downtrends 【4:01†source】 【4:17†source】 .Level Identification:
Mark levels on the hourly chart where the price changes trend (e.g., from downtrend to uptrend).
Use the open price of the candle that starts the new trend direction as your level 【4:11†source】 .`
const parsed_transcription = string_variable.replace(/\【([01]?[0-9]|2[0-3]):[0-5][0-9](:[0-5][0-9])?†source\】/g,'');
console.log({parsed_transcription});
@bajajcodes
bajajcodes / outbound_call.py
Last active May 24, 2024 05:42
Outbound call setup along with services(environment) required.
import os
from dotenv import load_dotenv
load_dotenv()
from vocode.streaming.telephony.conversation.outbound_call import OutboundCall
from vocode.streaming.telephony.config_manager.redis_config_manager import RedisConfigManager
from langchain.memory import ConversationBufferMemory
from vocode.streaming.models.agent import ChatGPTAgentConfig
from vocode.streaming.models.synthesizer import AzureSynthesizerConfig
@bajajcodes
bajajcodes / main.py
Created May 24, 2024 04:37
This code is for setting up telephony server
import logging
import os
import sys
# Third-party imports
from fastapi import FastAPI
from vocode.streaming.telephony.config_manager.redis_config_manager import (
RedisConfigManager,
)
from vocode.streaming.telephony.server.base import (
@bajajcodes
bajajcodes / decision-tree.json
Last active April 13, 2024 04:30
Decision Tree Json
[
{
"text": "To schedule a new appointment, press 1.",
"response": "Please hold while we transfer you to our scheduling department.",
"isEndOfInteraction": true
},
{
"text": "For prescription refills, press 2.",
"response": "Please leave a message with your name, date of birth, and the medication you need refilled. Our pharmacist will process your request within 24 hours.",
"isEndOfDecisionTree": true
@bajajcodes
bajajcodes / quizes.ts
Last active December 7, 2023 10:03
Quizes JSON Structure
type QuestionOption = "Yes" | "No" | "YES" | "NO";
interface Question {
answer: QuestionOption;
question: string;
options: QuestionOption[];
}
interface Quiz {
imageURL: string;
@bajajcodes
bajajcodes / getRateLimiter.js
Last active February 16, 2023 03:26
Create a rate limiter function with configuration options on route basis.
function getRateLimiter(options = {}) {
// TODO: add check here for options coming
const rateLimiterFastBruteByIP = new RateLimiterMemory({ ...options, ...RATE_LIMITER_FAST_BRUTE_BY_IP_OPTIONS });
return async function authorizationLimiter(req, res, next) {
// INFO: get the clientIP when running behind a proxy
const ipAddress = req.headers["x-forwarded-for"] || req.socket.remoteAddress;
let retrySeconds = 0;
try {
const rateLimiterResponse = await rateLimiterFastBruteByIP.get(ipAddress);
if (rateLimiterResponse && rateLimiterResponse.consumedPoints > RATE_LIMITER_FAST_BRUTE_BY_IP_OPTIONS.points) {