diff --git a/02_Summarization/02.long-text-summarization-titan.ipynb b/02_Summarization/02.long-text-summarization-titan.ipynb index 488da3ea..38ad13e9 100644 --- a/02_Summarization/02.long-text-summarization-titan.ipynb +++ b/02_Summarization/02.long-text-summarization-titan.ipynb @@ -129,16 +129,16 @@ "source": [ "from langchain.llms.bedrock import Bedrock\n", "\n", - "llm = Bedrock(model_id=\"amazon.titan-tg1-large\", \n", - " model_kwargs ={\n", - " \"textGenerationConfig\": {\n", - " \"maxTokenCount\": 4096,\n", - " \"stopSequences\": [],\n", - " \"temperature\":0,\n", - " \"topP\":1\n", - " },\n", - " },\n", - " client=boto3_bedrock)" + "llm = Bedrock(\n", + " model_id=\"amazon.titan-tg1-large\",\n", + " model_kwargs={\n", + " \"maxTokenCount\": 4096,\n", + " \"stopSequences\": [],\n", + " \"temperature\": 0,\n", + " \"topP\": 1,\n", + " },\n", + " client=boto3_bedrock,\n", + ")" ] }, { diff --git a/03_QuestionAnswering/01_qa_w_rag_claude.ipynb b/03_QuestionAnswering/01_qa_w_rag_claude.ipynb index cbd7cb15..96d53e78 100644 --- a/03_QuestionAnswering/01_qa_w_rag_claude.ipynb +++ b/03_QuestionAnswering/01_qa_w_rag_claude.ipynb @@ -204,13 +204,15 @@ "outputs": [], "source": [ "from urllib.request import urlretrieve\n", + "\n", + "os.makedirs(\"data\", exist_ok=True)\n", "files = [\n", - " 'https://www.irs.gov/pub/irs-pdf/p1544.pdf',\n", - " 'https://www.irs.gov/pub/irs-pdf/p15.pdf',\n", - " 'https://www.irs.gov/pub/irs-pdf/p1212.pdf'\n", + " \"https://www.irs.gov/pub/irs-pdf/p1544.pdf\",\n", + " \"https://www.irs.gov/pub/irs-pdf/p15.pdf\",\n", + " \"https://www.irs.gov/pub/irs-pdf/p1212.pdf\",\n", "]\n", "for url in files:\n", - " file_path = './data/' + url.split('/')[-1]\n", + " file_path = os.path.join(\"data\", url.rpartition(\"/\")[2])\n", " urlretrieve(url, file_path)" ] }, @@ -443,7 +445,6 @@ "metadata": {}, "outputs": [], "source": [ - "\n", "from langchain.chains import RetrievalQA\n", "from langchain.prompts import PromptTemplate\n", "\n", @@ -453,6 +454,7 @@ "\n", "Question: {question}\n", "Assistant:\"\"\"\n", + "\n", "PROMPT = PromptTemplate(\n", " template=prompt_template, input_variables=[\"context\", \"question\"]\n", ")\n", diff --git a/04_Chatbot/00_Chatbot_Claude.ipynb b/04_Chatbot/00_Chatbot_Claude.ipynb index fe7b31dc..babb9ee0 100644 --- a/04_Chatbot/00_Chatbot_Claude.ipynb +++ b/04_Chatbot/00_Chatbot_Claude.ipynb @@ -162,7 +162,7 @@ ")\n", "memory = ConversationBufferMemory()\n", "conversation = ConversationChain(\n", - " llm=titan_llm, verbose=True, memory=memory\n", + " llm=cl_llm, verbose=True, memory=memory\n", ")\n", "\n", "print_ww(conversation.predict(input=\"Hi there!\"))" @@ -591,7 +591,6 @@ }, "outputs": [], "source": [ - "\n", "from langchain.chains.conversational_retrieval.prompts import CONDENSE_QUESTION_PROMPT\n", "\n", "print_ww(CONDENSE_QUESTION_PROMPT.template)"