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 logging | |
import sys | |
import nest_asyncio | |
nest_asyncio.apply() | |
logging.basicConfig(stream=sys.stdout, level=logging.INFO) | |
logging.getLogger().addHandler(logging.StreamHandler(stream=sys.stdout)) | |
from llama_index import ( | |
LLMPredictor, | |
GPTVectorStoreIndex, |
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
# https://www.mongodb.com/docs/atlas/atlas-search/knn-beta/ | |
import pymongo | |
from langchain.embeddings.openai import OpenAIEmbeddings | |
from langchain.llms import AzureOpenAI | |
import os | |
from rake_nltk import Rake | |
from langchain.agents import initialize_agent, Tool | |
MONGO_URI = "mongodb+srv://....mongodb.net/?retryWrites=true&w=majority&tls=true" | |
MONGODB_DATABASE = "demo_db" |
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
# https://www.mongodb.com/docs/atlas/atlas-search/knn-beta/ | |
import pymongo | |
from langchain.embeddings.openai import OpenAIEmbeddings | |
from langchain.llms import AzureOpenAI | |
import os | |
import glob | |
import time | |
from multiprocessing import Pool | |
from tqdm import tqdm | |
from rake_nltk import Rake |
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
# Inspired by: https://github.com/gkamradt/langchain-tutorials/blob/main/data_generation/5%20Levels%20Of%20Summarization%20-%20Novice%20To%20Expert.ipynb | |
from langchain.embeddings.openai import OpenAIEmbeddings | |
from langchain.llms import AzureOpenAI | |
import numpy as np | |
from multiprocessing import Pool | |
from tqdm import tqdm | |
from langchain.chains.summarize import load_summarize_chain | |
from langchain.embeddings.openai import OpenAIEmbeddings | |
from langchain.text_splitter import RecursiveCharacterTextSplitter | |
from langchain.vectorstores import MongoDBAtlasVectorSearch |
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
# inspired by: https://github.com/hollaugo/chatgpt-slack-app/blob/main/app.py | |
import json | |
import pymongo | |
from langchain.embeddings.openai import OpenAIEmbeddings | |
from langchain.llms import AzureOpenAI | |
import os | |
import requests | |
from slack_bolt import App | |
from slack_bolt.adapter.socket_mode import SocketModeHandler | |
from dotenv import load_dotenv |
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 requests | |
def start_conversation(): | |
url = "https://api.mendable.ai/v0/newConversation" | |
payload = { | |
"api_key": "API_KEY_GOES_HERE" | |
} | |
headers = { | |
"Content-Type": "application/json" |
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 pymongo import MongoClient | |
import logging | |
from langchain.document_loaders import PlaywrightURLLoader | |
from langchain.vectorstores import MongoDBAtlasVectorSearch | |
from langchain.embeddings.openai import OpenAIEmbeddings | |
from langchain.embeddings import GPT4AllEmbeddings | |
gpt4all_embd = GPT4AllEmbeddings() | |
LOGGER = logging.getLogger(__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 openai | |
from actionweaver.llms.openai.chat import OpenAIChatCompletion | |
from actionweaver import action, RequireNext | |
openai.api_key = "sk-test" #os.getenv("OPENAI_API_KEY") | |
from pymongo import MongoClient | |
connection_string="mongodb+srv://test:[email protected]/?retryWrites=true&w=majority" | |
mongodb_client = MongoClient(connection_string) | |
@action(name="query_airbnb",orch_expr=RequireNext(['query_airbnb'])) |
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 itertools | |
import openai | |
from actionweaver.llms.openai.chat import OpenAIChatCompletion | |
from actionweaver import action, RequireNext,SelectOne | |
openai.api_key = "sk-" #os.getenv("OPENAI_API_KEY") | |
from pymongo import MongoClient | |
import json | |
connection_string="mongodb+srv://abc123:[email protected]/?retryWrites=true&w=majority" | |
mongodb_client = MongoClient(connection_string) |
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 council.agents import Agent | |
from council.chains import Chain | |
from council.llm import AzureLLM | |
from council.skills import LLMSkill | |
from council.agents import Agent | |
from council.filters import BasicFilter | |
from council.controllers import LLMController | |
from council.evaluators import LLMEvaluator | |
import os |