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 langchain.prompts import ChatPromptTemplate | |
from langchain.chat_models import ChatOpenAI | |
from apikey import OPENAI_API_KEY | |
import os | |
os.environ['OPENAI_API_KEY'] = OPENAI_API_KEY | |
model = ChatOpenAI() | |
prompt = ChatPromptTemplate.from_template("In 2016, who was the president of {country}") |
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 langchain.vectorstores import Chroma | |
from langchain.embeddings import OpenAIEmbeddings | |
from langchain.schema.runnable import RunnablePassthrough | |
from langchain.schema.output_parser import StrOutputParser | |
from langchain.prompts import ChatPromptTemplate | |
from langchain.chat_models import ChatOpenAI | |
from operator import itemgetter | |
from apikey import OPENAI_API_KEY | |
import os |
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 flask import render_template, redirect, url_for, request, flash, session | |
from app import app | |
from app.forms import EmptyForm | |
from pdf_bot_class import PdfBot | |
from io import BytesIO | |
from uuid import uuid4 | |
@app.route('/') | |
@app.route('/index') |
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 os | |
import PyPDF2 | |
from embedchain import App | |
from config import Config | |
from embedchain.config import ChunkerConfig, AddConfig | |
OPENAI_KEY = Config.OPENAI_KEY | |
chunker_config = ChunkerConfig(chunk_size=500, chunk_overlap=100) |
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
[nlp] | |
lang = "en" | |
pipeline = ["llm"] | |
[components] | |
[components.llm] | |
factory = "llm" | |
[components.llm.task] |
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 keys import OPENAI_API_KEY | |
import os | |
from spacy_llm.util import assemble | |
os.environ["OPENAI_API_KEY"] = OPENAI_API_KEY | |
nlp = assemble("config.cfg") | |
doc = nlp("You are an idiot !") | |
print(doc.cats) |
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 pandas as pd | |
from keys import OPENAI_API_KEY | |
import os | |
from spacy_llm.util import assemble | |
import pandas as pd | |
os.environ["OPENAI_API_KEY"] = OPENAI_API_KEY | |
nlp = assemble("email_config.cfg") |
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
[nlp] | |
lang = "en" | |
pipeline = ["llm"] | |
[components] | |
[components.llm] | |
factory = "llm" | |
[components.llm.task] |
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
# Example of a simple corpus | |
corpus = [ | |
"Natural Language Processing is fascinating.", | |
"ChatGPT is based on GPT-3.", | |
"Machine learning is an application of artificial intelligence." | |
] |
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 nltk.tokenize import word_tokenize | |
sentence = "Natural Language Processing is fascinating." | |
tokens = word_tokenize(sentence) | |
print(tokens) | |
# Output: ['Natural', 'Language', 'Processing', 'is', 'fascinating', '.'] |
OlderNewer