This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Main function to get comments from the active Google Document, send them to the Azure OpenAI API, and log the responses. | |
*/ | |
function respondToComments() { | |
try { | |
// Get the active document and its ID | |
var doc = DocumentApp.getActiveDocument(); | |
var documentId = doc.getId(); | |
// Get the body text of the document |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getComments() { | |
try { | |
var doc = DocumentApp.getActiveDocument(); | |
var documentId = doc.getId(); | |
var fields = 'comments(author/displayName,content,createdTime),nextPageToken'; | |
var pageToken = null; | |
var comments = []; | |
do { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import necessary libraries | |
from langgraph.graph import StateGraph, END | |
from typing import Dict, TypedDict, Optional, Literal, List, Union | |
# Define Graph State | |
class GraphState(TypedDict): | |
init_input: Optional[str] = None | |
fruit: Optional[str] = None | |
final_result: Optional[str] = None | |
user_confirmation: Optional[str] = None |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from unstructured.partition.auto import partition | |
import pymongo | |
from openai import AzureOpenAI | |
az_client = AzureOpenAI(azure_endpoint="",api_version="",api_key="") | |
def generate_embeddings(text, model=""): # model = "deployment_name" | |
return az_client.embeddings.create(input = [text], model=model).data[0].embedding | |
MDB_URI = "" | |
DB_NAME = "" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import requests | |
def get_repo_info(owner, repo): | |
url = f"https://api.github.com/repos/{owner}/{repo}" | |
headers = {"Accept": "application/vnd.github+json"} | |
response = requests.get(url, headers=headers) | |
if response.status_code == 200: | |
return response.json() | |
else: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from openai import AzureOpenAI | |
import os | |
import subprocess | |
import json | |
from shutil import rmtree | |
# Azure OpenAI configuration | |
azure_openai_endpoint = os.getenv('OPENAI_AZURE_ENDPOINT', '') | |
azure_openai_api_key = os.getenv('OPENAI_API_KEY', '') | |
azure_openai_deployment_id = '' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from openai import AzureOpenAI | |
import os | |
import subprocess | |
import json | |
from shutil import rmtree | |
# Azure OpenAI configuration | |
azure_openai_endpoint = os.getenv('OPENAI_AZURE_ENDPOINT', '') | |
azure_openai_api_key = os.getenv('OPENAI_API_KEY', '') | |
azure_openai_deployment_id = '' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from youtube_transcript_api import YouTubeTranscriptApi | |
from duckduckgo_search import DDGS | |
from openai import AzureOpenAI | |
# Replace with your actual values | |
AZURE_OPENAI_ENDPOINT = "https://DEMO.openai.azure.com" | |
AZURE_OPENAI_API_KEY = "" | |
deployment_name = "gpt-4-32k" # The name of your model deployment | |
client = AzureOpenAI(azure_endpoint=AZURE_OPENAI_ENDPOINT,api_version="2023-07-01-preview",api_key=AZURE_OPENAI_API_KEY) | |
# Replace with your actual values - if desired |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from elevenlabs.client import ElevenLabs | |
from elevenlabs import play | |
from langchain_community.vectorstores import MongoDBAtlasVectorSearch | |
from langchain_openai import AzureOpenAIEmbeddings | |
from langchain_core.messages import HumanMessage | |
from langchain_openai import AzureChatOpenAI | |
import pymongo | |
# PDF loaded into MongoDB Atlas = https://arxiv.org/pdf/2303.08774.pdf | |
MDB_URI = "" | |
cluster = pymongo.MongoClient(MDB_URI) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pymongo | |
import os | |
from openai import AzureOpenAI | |
# Replace with your actual values | |
AZURE_OPENAI_ENDPOINT = "https://DEMO.openai.azure.com" | |
AZURE_OPENAI_API_KEY = "DEMO" | |
deployment_name = "gpt-4-32k" # The name of your model deployment | |
MDB_URI = "" | |
# Authenticate and create client |
NewerOlder