|
275 | 275 | },
|
276 | 276 | {
|
277 | 277 | "cell_type": "code",
|
278 |
| - "execution_count": 4, |
| 278 | + "execution_count": 19, |
279 | 279 | "metadata": {},
|
280 | 280 | "outputs": [
|
281 | 281 | {
|
|
337 | 337 | " response = co.chat(message=message, search_queries_only=True)\n",
|
338 | 338 | "\n",
|
339 | 339 | " # If there are search queries, retrieve documents and respond\n",
|
340 |
| - " preamble_override = \"You only answer questions using on the documents you have provided with\"\n", |
| 340 | + " # preamble_override = \"You only answer questions using on the documents you have provided with\"\n", |
341 | 341 | " \n",
|
342 | 342 | " if response.search_queries:\n",
|
343 | 343 | " print(\"Retrieving information...\")\n",
|
|
346 | 346 | "\n",
|
347 | 347 | " response = co.chat(\n",
|
348 | 348 | " message=message,\n",
|
349 |
| - " preamble_override = preamble_override,\n", |
| 349 | + " # preamble_override = preamble_override,\n", |
350 | 350 | " documents=documents,\n",
|
351 | 351 | " conversation_id=self.conversation_id,\n",
|
352 | 352 | " stream=True,\n",
|
|
359 | 359 | " else:\n",
|
360 | 360 | " response = co.chat(\n",
|
361 | 361 | " message=message,\n",
|
362 |
| - " preamble_override = preamble_override,\n", |
| 362 | + " # preamble_override = preamble_override,\n", |
363 | 363 | " conversation_id=self.conversation_id, \n",
|
364 | 364 | " stream=True\n",
|
365 | 365 | " )\n",
|
|
400 | 400 | },
|
401 | 401 | {
|
402 | 402 | "cell_type": "code",
|
403 |
| - "execution_count": 10, |
| 403 | + "execution_count": 13, |
404 | 404 | "metadata": {},
|
405 | 405 | "outputs": [
|
406 | 406 | {
|
|
592 | 592 | },
|
593 | 593 | {
|
594 | 594 | "cell_type": "code",
|
595 |
| - "execution_count": 11, |
| 595 | + "execution_count": 27, |
596 | 596 | "metadata": {},
|
597 | 597 | "outputs": [
|
598 | 598 | {
|
|
617 | 617 | "name": "stdout",
|
618 | 618 | "output_type": "stream",
|
619 | 619 | "text": [
|
620 |
| - "User: Hello\n", |
| 620 | + "User: Hello, I have a question\n", |
621 | 621 | "Chatbot:\n",
|
622 |
| - "Hello there, how can I assist you today?\n", |
623 |
| - "\n", |
624 |
| - "Please provide some further information or give me a specific question, and I'll do my best to help you out!\n", |
| 622 | + "Hello there! I'm happy to help with any questions or discussions you have in mind today. Go ahead and ask away, and I'll do my best to provide helpful, informative responses.\n", |
625 | 623 | "----------------------------------------------------------------------------------------------------\n",
|
626 | 624 | "\n",
|
627 |
| - "User: What is the difference between word and sentence embeddings\n", |
| 625 | + "User: What’s the difference between word and sentence embeddings\n", |
628 | 626 | "Chatbot:\n",
|
629 | 627 | "Retrieving information...\n",
|
630 |
| - "Word embeddings and sentence embeddings are the fundamental components of LLMs and convert language (words) into computer speak (numbers) in a way that preserves the relationships between words, semantics, and linguistic nuances into numerical equations. \n", |
| 628 | + "Word embeddings and sentence embeddings are both responsible for translating human language (words) into computer language (numbers).\n", |
631 | 629 | "\n",
|
632 |
| - "Word embeddings associate words with lists of numbers (vectors) in a way that groups similar words together. Sentence embeddings do the same thing but for sentences.\n", |
| 630 | + "Word embeddings associate words with lists of numbers (vectors) in a way that similar words are grouped close together. Sentence embeddings do the same thing but for sentences, where similar sentences are grouped closer together.\n", |
633 | 631 | "\n",
|
634 | 632 | "CITATIONS:\n",
|
635 | 633 | "{'start': 0, 'end': 15, 'text': 'Word embeddings', 'document_ids': ['doc_0', 'doc_1', 'doc_2']}\n",
|
636 | 634 | "{'start': 20, 'end': 39, 'text': 'sentence embeddings', 'document_ids': ['doc_0', 'doc_1', 'doc_2']}\n",
|
637 |
| - "{'start': 48, 'end': 78, 'text': 'fundamental components of LLMs', 'document_ids': ['doc_2']}\n", |
638 |
| - "{'start': 83, 'end': 137, 'text': 'convert language (words) into computer speak (numbers)', 'document_ids': ['doc_2']}\n", |
639 |
| - "{'start': 152, 'end': 228, 'text': 'preserves the relationships between words, semantics, and linguistic nuances', 'document_ids': ['doc_2']}\n", |
640 |
| - "{'start': 234, 'end': 254, 'text': 'numerical equations.', 'document_ids': ['doc_2']}\n", |
641 |
| - "{'start': 257, 'end': 365, 'text': 'Word embeddings associate words with lists of numbers (vectors) in a way that groups similar words together.', 'document_ids': ['doc_0', 'doc_1']}\n", |
642 |
| - "{'start': 366, 'end': 422, 'text': 'Sentence embeddings do the same thing but for sentences.', 'document_ids': ['doc_0', 'doc_1']}\n", |
| 635 | + "{'start': 65, 'end': 132, 'text': 'translating human language (words) into computer language (numbers)', 'document_ids': ['doc_2']}\n", |
| 636 | + "{'start': 135, 'end': 254, 'text': 'Word embeddings associate words with lists of numbers (vectors) in a way that similar words are grouped close together.', 'document_ids': ['doc_0']}\n", |
| 637 | + "{'start': 255, 'end': 310, 'text': 'Sentence embeddings do the same thing but for sentences', 'document_ids': ['doc_0', 'doc_1']}\n", |
| 638 | + "{'start': 318, 'end': 364, 'text': 'similar sentences are grouped closer together.', 'document_ids': ['doc_1']}\n", |
643 | 639 | "\n",
|
644 | 640 | "\n",
|
645 | 641 | "DOCUMENTS:\n",
|
|
649 | 645 | "\n",
|
650 | 646 | "----------------------------------------------------------------------------------------------------\n",
|
651 | 647 | "\n",
|
| 648 | + "User: And what are their similarities\n", |
| 649 | + "Chatbot:\n", |
| 650 | + "Retrieving information...\n", |
| 651 | + "The similarities between word and sentence embeddings are that they both rely on vector representations of numerical values, and they both allow for calculations of similarity. Word embeddings focus on the similarity between individual words, whereas sentence embeddings compare entire sentences. \n", |
| 652 | + "\n", |
| 653 | + "The similarities between sentences can be calculated using cosine similarity, which is also the case for word embeddings. The similarity between each sentence and itself is always the highest (around 8000 for cosine similarity), while the similarity between different sentences is much lower.\n", |
| 654 | + "\n", |
| 655 | + "CITATIONS:\n", |
| 656 | + "{'start': 73, 'end': 123, 'text': 'rely on vector representations of numerical values', 'document_ids': ['doc_2']}\n", |
| 657 | + "{'start': 134, 'end': 176, 'text': 'both allow for calculations of similarity.', 'document_ids': ['doc_0', 'doc_1', 'doc_3', 'doc_4', 'doc_5']}\n", |
| 658 | + "{'start': 177, 'end': 241, 'text': 'Word embeddings focus on the similarity between individual words', 'document_ids': ['doc_0', 'doc_1', 'doc_3', 'doc_4', 'doc_5']}\n", |
| 659 | + "{'start': 251, 'end': 296, 'text': 'sentence embeddings compare entire sentences.', 'document_ids': ['doc_0', 'doc_1', 'doc_3', 'doc_4', 'doc_5']}\n", |
| 660 | + "{'start': 303, 'end': 375, 'text': 'similarities between sentences can be calculated using cosine similarity', 'document_ids': ['doc_0', 'doc_1', 'doc_3', 'doc_4', 'doc_5']}\n", |
| 661 | + "{'start': 404, 'end': 420, 'text': 'word embeddings.', 'document_ids': ['doc_0', 'doc_1', 'doc_3', 'doc_4', 'doc_5']}\n", |
| 662 | + "{'start': 425, 'end': 490, 'text': 'similarity between each sentence and itself is always the highest', 'document_ids': ['doc_5']}\n", |
| 663 | + "{'start': 491, 'end': 526, 'text': '(around 8000 for cosine similarity)', 'document_ids': ['doc_1', 'doc_3', 'doc_5']}\n", |
| 664 | + "{'start': 538, 'end': 591, 'text': 'similarity between different sentences is much lower.', 'document_ids': ['doc_0', 'doc_1', 'doc_3', 'doc_4']}\n", |
| 665 | + "\n", |
| 666 | + "\n", |
| 667 | + "DOCUMENTS:\n", |
| 668 | + "{'id': 'doc_2', 'text': 'One would expect the two first sentences to have a...', 'title': 'Similarity Between Words and Sentences', 'url': 'https://docs.cohere.com/docs/similarity-between-words-and-sentences'}\n", |
| 669 | + "{'id': 'doc_0', 'text': 'And the results are:\\n\\nThe similarity between sente...', 'title': 'Similarity Between Words and Sentences', 'url': 'https://docs.cohere.com/docs/similarity-between-words-and-sentences'}\n", |
| 670 | + "{'id': 'doc_1', 'text': 'This checks out as well! The similarity between se...', 'title': 'Similarity Between Words and Sentences', 'url': 'https://docs.cohere.com/docs/similarity-between-words-and-sentences'}\n", |
| 671 | + "{'id': 'doc_3', 'text': 'This checks out as well! The similarity between se...', 'title': 'Similarity Between Words and Sentences', 'url': 'https://docs.cohere.com/docs/similarity-between-words-and-sentences'}\n", |
| 672 | + "{'id': 'doc_4', 'text': 'And the results are:\\n\\nThe similarity between sente...', 'title': 'Similarity Between Words and Sentences', 'url': 'https://docs.cohere.com/docs/similarity-between-words-and-sentences'}\n", |
| 673 | + "{'id': 'doc_5', 'text': 'Just for consistency, let’s calculate the similari...', 'title': 'Similarity Between Words and Sentences', 'url': 'https://docs.cohere.com/docs/similarity-between-words-and-sentences'}\n", |
| 674 | + "\n", |
| 675 | + "----------------------------------------------------------------------------------------------------\n", |
| 676 | + "\n", |
| 677 | + "User: What do you know about graph neural networks\n", |
| 678 | + "Chatbot:\n", |
| 679 | + "Retrieving information...\n", |
| 680 | + "Graph neural networks are a newer concept in the world of neural networks. Using graph neural networks, programmers can develop models that analyze datasets comprised of pairs of entities and edges between those entities. These edges convey relationships between the entities, such as a connection between two entities or a similarity between entities. \n", |
| 681 | + "\n", |
| 682 | + "To construct graph neural networks, programmers use node embedding, a process that assigns a vector to each node in the graph. The vectors are designed so that their underlying information is preserved when compared to the original graph.\n", |
| 683 | + "----------------------------------------------------------------------------------------------------\n", |
| 684 | + "\n", |
652 | 685 | "Ending chat.\n"
|
653 | 686 | ]
|
654 | 687 | }
|
|
0 commit comments