diff --git a/docs/examples/vector_stores/MongoDBAtlasVectorSearchRAGOpenAI.ipynb b/docs/examples/vector_stores/MongoDBAtlasVectorSearchRAGOpenAI.ipynb new file mode 100644 index 0000000000000..393a811c91db9 --- /dev/null +++ b/docs/examples/vector_stores/MongoDBAtlasVectorSearchRAGOpenAI.ipynb @@ -0,0 +1,1242 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "!pip install llama-index\n", + "!pip install llama-index-vector-stores-mongodb\n", + "!pip install llama-index-embeddings-openai\n", + "!pip install pymongo\n", + "!pip install datasets\n", + "!pip install pandas" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "%env OPENAI_API_KEY=OPENAI_API_KEY" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n", + "
\n", + " | awards | \n", + "metacritic | \n", + "rated | \n", + "fullplot | \n", + "title | \n", + "writers | \n", + "languages | \n", + "plot | \n", + "plot_embedding | \n", + "runtime | \n", + "countries | \n", + "genres | \n", + "directors | \n", + "cast | \n", + "type | \n", + "imdb | \n", + "poster | \n", + "num_mflix_comments | \n", + "
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | \n", + "{'nominations': 0, 'text': '1 win.', 'wins': 1} | \n", + "NaN | \n", + "None | \n", + "Young Pauline is left a lot of money when her ... | \n", + "The Perils of Pauline | \n", + "[Charles W. Goddard (screenplay), Basil Dickey... | \n", + "[English] | \n", + "Young Pauline is left a lot of money when her ... | \n", + "[0.00072939653, -0.026834568, 0.013515796, -0.... | \n", + "199.0 | \n", + "[USA] | \n", + "[Action] | \n", + "[Louis J. Gasnier, Donald MacKenzie] | \n", + "[Pearl White, Crane Wilbur, Paul Panzer, Edwar... | \n", + "movie | \n", + "{'id': 4465, 'rating': 7.6, 'votes': 744} | \n", + "https://m.media-amazon.com/images/M/MV5BMzgxOD... | \n", + "0 | \n", + "
1 | \n", + "{'nominations': 1, 'text': '1 nomination.', 'w... | \n", + "NaN | \n", + "TV-G | \n", + "As a penniless man worries about how he will m... | \n", + "From Hand to Mouth | \n", + "[H.M. Walker (titles)] | \n", + "[English] | \n", + "A penniless young man tries to save an heiress... | \n", + "[-0.022837115, -0.022941574, 0.014937485, -0.0... | \n", + "22.0 | \n", + "[USA] | \n", + "[Comedy, Short, Action] | \n", + "[Alfred J. Goulding, Hal Roach] | \n", + "[Harold Lloyd, Mildred Davis, 'Snub' Pollard, ... | \n", + "movie | \n", + "{'id': 10146, 'rating': 7.0, 'votes': 639} | \n", + "https://m.media-amazon.com/images/M/MV5BNzE1OW... | \n", + "0 | \n", + "
2 | \n", + "{'nominations': 0, 'text': '1 win.', 'wins': 1} | \n", + "NaN | \n", + "None | \n", + "Michael \"Beau\" Geste leaves England in disgrac... | \n", + "Beau Geste | \n", + "[Herbert Brenon (adaptation), John Russell (ad... | \n", + "[English] | \n", + "Michael \"Beau\" Geste leaves England in disgrac... | \n", + "[0.00023330493, -0.028511643, 0.014653289, -0.... | \n", + "101.0 | \n", + "[USA] | \n", + "[Action, Adventure, Drama] | \n", + "[Herbert Brenon] | \n", + "[Ronald Colman, Neil Hamilton, Ralph Forbes, A... | \n", + "movie | \n", + "{'id': 16634, 'rating': 6.9, 'votes': 222} | \n", + "None | \n", + "0 | \n", + "
3 | \n", + "{'nominations': 0, 'text': '1 win.', 'wins': 1} | \n", + "NaN | \n", + "None | \n", + "A nobleman vows to avenge the death of his fat... | \n", + "The Black Pirate | \n", + "[Douglas Fairbanks (story), Jack Cunningham (a... | \n", + "None | \n", + "Seeking revenge, an athletic young man joins t... | \n", + "[-0.005927917, -0.033394486, 0.0015323418, -0.... | \n", + "88.0 | \n", + "[USA] | \n", + "[Adventure, Action] | \n", + "[Albert Parker] | \n", + "[Billie Dove, Tempe Pigott, Donald Crisp, Sam ... | \n", + "movie | \n", + "{'id': 16654, 'rating': 7.2, 'votes': 1146} | \n", + "https://m.media-amazon.com/images/M/MV5BMzU0ND... | \n", + "1 | \n", + "
4 | \n", + "{'nominations': 1, 'text': '1 nomination.', 'w... | \n", + "NaN | \n", + "PASSED | \n", + "The Uptown Boy, J. Harold Manners (Lloyd) is a... | \n", + "For Heaven's Sake | \n", + "[Ted Wilde (story), John Grey (story), Clyde B... | \n", + "[English] | \n", + "An irresponsible young millionaire changes his... | \n", + "[-0.0059373598, -0.026604708, -0.0070914757, -... | \n", + "58.0 | \n", + "[USA] | \n", + "[Action, Comedy, Romance] | \n", + "[Sam Taylor] | \n", + "[Harold Lloyd, Jobyna Ralston, Noah Young, Jim... | \n", + "movie | \n", + "{'id': 16895, 'rating': 7.6, 'votes': 918} | \n", + "https://m.media-amazon.com/images/M/MV5BMTcxMT... | \n", + "0 | \n", + "
\n", + " | awards | \n", + "metacritic | \n", + "rated | \n", + "fullplot | \n", + "title | \n", + "writers | \n", + "languages | \n", + "plot | \n", + "runtime | \n", + "countries | \n", + "genres | \n", + "directors | \n", + "cast | \n", + "type | \n", + "imdb | \n", + "poster | \n", + "num_mflix_comments | \n", + "
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | \n", + "{'nominations': 0, 'text': '1 win.', 'wins': 1} | \n", + "NaN | \n", + "None | \n", + "Young Pauline is left a lot of money when her ... | \n", + "The Perils of Pauline | \n", + "[Charles W. Goddard (screenplay), Basil Dickey... | \n", + "[English] | \n", + "Young Pauline is left a lot of money when her ... | \n", + "199.0 | \n", + "[USA] | \n", + "[Action] | \n", + "[Louis J. Gasnier, Donald MacKenzie] | \n", + "[Pearl White, Crane Wilbur, Paul Panzer, Edwar... | \n", + "movie | \n", + "{'id': 4465, 'rating': 7.6, 'votes': 744} | \n", + "https://m.media-amazon.com/images/M/MV5BMzgxOD... | \n", + "0 | \n", + "
1 | \n", + "{'nominations': 1, 'text': '1 nomination.', 'w... | \n", + "NaN | \n", + "TV-G | \n", + "As a penniless man worries about how he will m... | \n", + "From Hand to Mouth | \n", + "[H.M. Walker (titles)] | \n", + "[English] | \n", + "A penniless young man tries to save an heiress... | \n", + "22.0 | \n", + "[USA] | \n", + "[Comedy, Short, Action] | \n", + "[Alfred J. Goulding, Hal Roach] | \n", + "[Harold Lloyd, Mildred Davis, 'Snub' Pollard, ... | \n", + "movie | \n", + "{'id': 10146, 'rating': 7.0, 'votes': 639} | \n", + "https://m.media-amazon.com/images/M/MV5BNzE1OW... | \n", + "0 | \n", + "
2 | \n", + "{'nominations': 0, 'text': '1 win.', 'wins': 1} | \n", + "NaN | \n", + "None | \n", + "Michael \"Beau\" Geste leaves England in disgrac... | \n", + "Beau Geste | \n", + "[Herbert Brenon (adaptation), John Russell (ad... | \n", + "[English] | \n", + "Michael \"Beau\" Geste leaves England in disgrac... | \n", + "101.0 | \n", + "[USA] | \n", + "[Action, Adventure, Drama] | \n", + "[Herbert Brenon] | \n", + "[Ronald Colman, Neil Hamilton, Ralph Forbes, A... | \n", + "movie | \n", + "{'id': 16634, 'rating': 6.9, 'votes': 222} | \n", + "None | \n", + "0 | \n", + "
3 | \n", + "{'nominations': 0, 'text': '1 win.', 'wins': 1} | \n", + "NaN | \n", + "None | \n", + "A nobleman vows to avenge the death of his fat... | \n", + "The Black Pirate | \n", + "[Douglas Fairbanks (story), Jack Cunningham (a... | \n", + "None | \n", + "Seeking revenge, an athletic young man joins t... | \n", + "88.0 | \n", + "[USA] | \n", + "[Adventure, Action] | \n", + "[Albert Parker] | \n", + "[Billie Dove, Tempe Pigott, Donald Crisp, Sam ... | \n", + "movie | \n", + "{'id': 16654, 'rating': 7.2, 'votes': 1146} | \n", + "https://m.media-amazon.com/images/M/MV5BMzU0ND... | \n", + "1 | \n", + "
4 | \n", + "{'nominations': 1, 'text': '1 nomination.', 'w... | \n", + "NaN | \n", + "PASSED | \n", + "The Uptown Boy, J. Harold Manners (Lloyd) is a... | \n", + "For Heaven's Sake | \n", + "[Ted Wilde (story), John Grey (story), Clyde B... | \n", + "[English] | \n", + "An irresponsible young millionaire changes his... | \n", + "58.0 | \n", + "[USA] | \n", + "[Action, Comedy, Romance] | \n", + "[Sam Taylor] | \n", + "[Harold Lloyd, Jobyna Ralston, Noah Young, Jim... | \n", + "movie | \n", + "{'id': 16895, 'rating': 7.6, 'votes': 918} | \n", + "https://m.media-amazon.com/images/M/MV5BMTcxMT... | \n", + "0 | \n", + "