id
stringlengths
14
15
text
stringlengths
17
2.72k
source
stringlengths
47
115
117580e35849-1
loader = AirbyteGongLoader(config=config, record_handler=handle_record, stream_name="calls") docs = loader.load() Incremental loads​ Some streams allow incremental loading, this means the source keeps track of synced records and won't load them again. This is useful for sources that have a high volume of data and are u...
https://python.langchain.com/docs/integrations/document_loaders/airbyte_gong
6967bd7a3f54-0
Apify This notebook shows how to use the Apify integration for LangChain. Apify is a cloud platform for web scraping and data extraction, which provides an ecosystem of more than a thousand ready-made apps called Actors for various web scraping, crawling, and data extraction use cases. For example, you can use it to ex...
https://python.langchain.com/docs/integrations/tools/apify.html
6967bd7a3f54-1
apify = ApifyWrapper() Then run the Actor, wait for it to finish, and fetch its results from the Apify dataset into a LangChain document loader. Note that if you already have some results in an Apify dataset, you can load them directly using ApifyDatasetLoader, as shown in this notebook. In that notebook, you'll also f...
https://python.langchain.com/docs/integrations/tools/apify.html
a334e5ad8217-0
Hugging Face Hub The Hugging Face Hub is a platform with over 120k models, 20k datasets, and 50k demo apps (Spaces), all open source and publicly available, in an online platform where people can easily collaborate and build ML together. This example showcases how to connect to the Hugging Face Hub and use different mo...
https://python.langchain.com/docs/integrations/llms/huggingface_hub.html
a334e5ad8217-1
print(llm_chain.run(question)) The FIFA World Cup was held in the year 1994. West Germany won the FIFA World Cup in 1994 Dolly, by Databricks​ See Databricks organization page for a list of available models. repo_id = "databricks/dolly-v2-3b" llm = HuggingFaceHub( repo_id=repo_id, model_kwargs={"temperature": 0.5, "max...
https://python.langchain.com/docs/integrations/llms/huggingface_hub.html
a334e5ad8217-2
Question: Who Camel, by Writer​ See Writer's organization page for a list of available models. repo_id = "Writer/camel-5b-hf" # See https://huggingface.co/Writer for other options llm = HuggingFaceHub( repo_id=repo_id, model_kwargs={"temperature": 0.5, "max_length": 64} ) llm_chain = LLMChain(prompt=prompt, llm=llm) pr...
https://python.langchain.com/docs/integrations/llms/huggingface_hub.html
a334e5ad8217-3
llm = HuggingFaceHub( repo_id=repo_id, model_kwargs={"max_length": 128, "temperature": 0.5} ) llm_chain = LLMChain(prompt=prompt, llm=llm) print(llm_chain.run(question))
https://python.langchain.com/docs/integrations/llms/huggingface_hub.html
56030b2e3f9f-0
Page Not Found We could not find what you were looking for. Please contact the owner of the site that linked you to the original URL and let them know their link is broken.
https://python.langchain.com/docs/integrations/llms/opaqueprompts.opaque.co/api-keys
7c8497680237-0
Milvus Milvus is a database that stores, indexes, and manages massive embedding vectors generated by deep neural networks and other machine learning (ML) models. This notebook shows how to use functionality related to the Milvus vector database. To run, you should have a Milvus instance up and running. We want to use O...
https://python.langchain.com/docs/integrations/vectorstores/milvus.html
26a4a994192d-0
Apify Dataset Apify Dataset is a scaleable append-only storage with sequential access built for storing structured web scraping results, such as a list of products or Google SERPs, and then export them to various formats like JSON, CSV, or Excel. Datasets are mainly used to save results of Apify Actors—serverless cloud...
https://python.langchain.com/docs/integrations/document_loaders/apify_dataset.html
26a4a994192d-1
https://docs.apify.com/platform/actors, https://docs.apify.com/platform/actors/running/actors-in-store, https://docs.apify.com/platform/security, https://docs.apify.com/platform/actors/examples
https://python.langchain.com/docs/integrations/document_loaders/apify_dataset.html
57ece35ddc04-0
ModelScope Let's load the ModelScope Embedding class. from langchain.embeddings import ModelScopeEmbeddings model_id = "damo/nlp_corom_sentence-embedding_english-base" embeddings = ModelScopeEmbeddings(model_id=model_id) text = "This is a test document." query_result = embeddings.embed_query(text) doc_results = embeddi...
https://python.langchain.com/docs/integrations/text_embedding/modelscope_hub.html
9dabe3f4026b-0
This notebook goes over how to use Momento Cache to store chat message history using the MomentoChatMessageHistory class. See the Momento docs for more detail on how to get set up with Momento. Note that, by default we will create a cache if one with the given name doesn't already exist. You'll need to get a Momento au...
https://python.langchain.com/docs/integrations/memory/momento_chat_message_history.html
23419a09dc98-0
MyScale MyScale is a cloud-based database optimized for AI applications and solutions, built on the open-source ClickHouse. This notebook shows how to use functionality related to the MyScale vector database. Setting up envrionments​ pip install clickhouse-connect We want to use OpenAIEmbeddings so we have to get the ...
https://python.langchain.com/docs/integrations/vectorstores/myscale.html
23419a09dc98-1
query = "What did the president say about Ketanji Brown Jackson" docs = docsearch.similarity_search(query) print(docs[0].page_content) Get connection info and data schema​ Filtering​ You can have direct access to myscale SQL where statement. You can write WHERE clause following standard SQL. NOTE: Please be aware of SQ...
https://python.langchain.com/docs/integrations/vectorstores/myscale.html
a0d7dbd4a403-0
Neo4j Vector Index Neo4j is an open-source graph database with integrated support for vector similarity search It supports: approximate nearest neighbor search L2 distance and cosine distance This notebook shows how to use the Neo4j vector index (Neo4jVector). See the installation instruction. # Pip install necessary p...
https://python.langchain.com/docs/integrations/vectorstores/neo4jvector.html
a0d7dbd4a403-1
Requirement already satisfied: certifi>=2017.4.17 in /home/tomaz/anaconda3/envs/myenv/lib/python3.11/site-packages (from requests>=2.20->openai) (2023.7.22) Requirement already satisfied: attrs>=17.3.0 in /home/tomaz/anaconda3/envs/myenv/lib/python3.11/site-packages (from aiohttp->openai) (23.1.0) Requirement already s...
https://python.langchain.com/docs/integrations/vectorstores/neo4jvector.html
a0d7dbd4a403-2
Requirement already satisfied: charset-normalizer<4,>=2 in /home/tomaz/anaconda3/envs/myenv/lib/python3.11/site-packages (from requests>=2.26.0->tiktoken) (3.2.0) Requirement already satisfied: idna<4,>=2.5 in /home/tomaz/anaconda3/envs/myenv/lib/python3.11/site-packages (from requests>=2.26.0->tiktoken) (3.4) Requirem...
https://python.langchain.com/docs/integrations/vectorstores/neo4jvector.html
a0d7dbd4a403-3
os.environ["OPENAI_API_KEY"] = getpass.getpass("OpenAI API Key:") from langchain.embeddings.openai import OpenAIEmbeddings from langchain.text_splitter import CharacterTextSplitter from langchain.vectorstores import Neo4jVector from langchain.document_loaders import TextLoader from langchain.docstore.document import Do...
https://python.langchain.com/docs/integrations/vectorstores/neo4jvector.html
a0d7dbd4a403-4
And I did that 4 days ago, when I nominated Circuit Court of Appeals Judge Ketanji Brown Jackson. One of our nation’s top legal minds, who will continue Justice Breyer’s legacy of excellence. -------------------------------------------------------------------------------- -----------------------------------------------...
https://python.langchain.com/docs/integrations/vectorstores/neo4jvector.html
a0d7dbd4a403-5
We’re securing commitments and supporting partners in South and Central America to host more refugees and secure their own borders. -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- Score: 0.891287088394165 A...
https://python.langchain.com/docs/integrations/vectorstores/neo4jvector.html
a0d7dbd4a403-6
store = Neo4jVector.from_existing_index( OpenAIEmbeddings(), url=url, username=username, password=password, index_name=index_name, ) Add documents​ We can add documents to the existing vectorstore. store.add_documents([Document(page_content="foo")]) ['2f70679a-4416-11ee-b7c3-d46a6aa24f5b'] docs_with_score = store.simil...
https://python.langchain.com/docs/integrations/vectorstores/neo4jvector.html
a0d7dbd4a403-7
return_only_outputs=True, ) {'answer': "The president honored Justice Stephen Breyer, who is retiring from the United States Supreme Court, and thanked him for his service. The president also mentioned that he nominated Circuit Court of Appeals Judge Ketanji Brown Jackson to continue Justice Breyer's legacy of excellen...
https://python.langchain.com/docs/integrations/vectorstores/neo4jvector.html
d03056f2f5fe-0
Notion DB 1/2 Notion is a collaboration platform with modified Markdown support that integrates kanban boards, tasks, wikis and databases. It is an all-in-one workspace for notetaking, knowledge and data management, and project and task management. This notebook covers how to load documents from a Notion database dump....
https://python.langchain.com/docs/integrations/document_loaders/notion.html
697c20c5ce90-0
Notion DB 2/2 Notion is a collaboration platform with modified Markdown support that integrates kanban boards, tasks, wikis and databases. It is an all-in-one workspace for notetaking, knowledge and data management, and project and task management. NotionDBLoader is a Python class for loading content from a Notion data...
https://python.langchain.com/docs/integrations/document_loaders/notiondb.html
697c20c5ce90-1
Click on the three-dot menu icon in the top right corner of the database view. Select "Copy link" from the menu to copy the database URL to your clipboard. The database ID is the long string of alphanumeric characters found in the URL. It typically looks like this: https://www.notion.so/username/8935f9d140a04f95a872520...
https://python.langchain.com/docs/integrations/document_loaders/notiondb.html
697c20c5ce90-2
NOTION_TOKEN = getpass() DATABASE_ID = getpass() from langchain.document_loaders import NotionDBLoader loader = NotionDBLoader( integration_token=NOTION_TOKEN, database_id=DATABASE_ID, request_timeout_sec=30, # optional, defaults to 10 )
https://python.langchain.com/docs/integrations/document_loaders/notiondb.html
afad00f76da8-0
Page Not Found We could not find what you were looking for. Please contact the owner of the site that linked you to the original URL and let them know their link is broken.
https://python.langchain.com/docs/integrations/llms/azure_openai_example.html
2640e09451fe-0
OpenLLM 🦾 OpenLLM is an open platform for operating large language models (LLMs) in production. It enables developers to easily run inference with any open-source LLMs, deploy to the cloud or on-premises, and build powerful AI apps. Installation​ Install openllm through PyPI Launch OpenLLM server locally​ To start an ...
https://python.langchain.com/docs/integrations/llms/openllm.html
25917100cb31-0
OpenAI Let's load the OpenAI Embedding class. from langchain.embeddings import OpenAIEmbeddings embeddings = OpenAIEmbeddings() text = "This is a test document." query_result = embeddings.embed_query(text) [-0.003186025367556387, 0.011071979803637493, -0.004020420763285827, -0.011658221276953042, -0.0010534035786864363...
https://python.langchain.com/docs/integrations/text_embedding/openai.html
85716f13eedb-0
OpenSearch OpenSearch is a scalable, flexible, and extensible open-source software suite for search, analytics, and observability applications licensed under Apache 2.0. OpenSearch is a distributed search and analytics engine based on Apache Lucene. This notebook shows how to use functionality related to the OpenSearch...
https://python.langchain.com/docs/integrations/vectorstores/opensearch.html
85716f13eedb-1
# If using the default Docker installation, use this instantiation instead: # docsearch = OpenSearchVectorSearch.from_documents( # docs, # embeddings, # opensearch_url="https://localhost:9200", # http_auth=("admin", "admin"), # use_ssl = False, # verify_certs = False, # ssl_assert_hostname = False, # ssl_show_warn = Fa...
https://python.langchain.com/docs/integrations/vectorstores/opensearch.html
85716f13eedb-2
query = "What did the president say about Ketanji Brown Jackson" docs = docsearch.similarity_search( "What did the president say about Ketanji Brown Jackson", k=1, search_type="script_scoring", ) print(docs[0].page_content) similarity_search using Painless Scripting​ similarity_search using Painless Scripting with Cust...
https://python.langchain.com/docs/integrations/vectorstores/opensearch.html
85716f13eedb-3
service = 'aoss' # must set the service as 'aoss' region = 'us-east-2' credentials = boto3.Session(aws_access_key_id='xxxxxx',aws_secret_access_key='xxxxx').get_credentials() awsauth = AWS4Auth('xxxxx', 'xxxxxx', region,service, session_token=credentials.token) docsearch = OpenSearchVectorSearch.from_documents( docs, ...
https://python.langchain.com/docs/integrations/vectorstores/opensearch.html
23f580e28571-0
This notebook goes over how to use the OpenWeatherMap component to fetch weather information. from langchain.llms import OpenAI from langchain.agents import load_tools, initialize_agent, AgentType import os os.environ["OPENAI_API_KEY"] = "" os.environ["OPENWEATHERMAP_API_KEY"] = "" llm = OpenAI(temperature=0) tools ...
https://python.langchain.com/docs/integrations/tools/openweathermap.html
3b106258757b-0
This notebook shows how to use the Postgres vector database (PGVector). We want to use OpenAIEmbeddings so we have to get the OpenAI API Key. # PGVector needs the connection string to the database. CONNECTION_STRING = "postgresql+psycopg2://harrisonchase@localhost:5432/test3" # # Alternatively, you can create it from ...
https://python.langchain.com/docs/integrations/vectorstores/pgvector.html
3b106258757b-1
And I did that 4 days ago, when I nominated Circuit Court of Appeals Judge Ketanji Brown Jackson. One of our nation’s top legal minds, who will continue Justice Breyer’s legacy of excellence. -------------------------------------------------------------------------------- -----------------------------------------------...
https://python.langchain.com/docs/integrations/vectorstores/pgvector.html
3b106258757b-2
And if we are to advance liberty and justice, we need to secure the Border and fix the immigration system. We can do both. At our border, we’ve installed new technology like cutting-edge scanners to better detect drug smuggling. We’ve set up joint patrols with Mexico and Guatemala to catch more human traffickers. ...
https://python.langchain.com/docs/integrations/vectorstores/pgvector.html
b6ee642bdd58-0
Pinecone Pinecone is a vector database with broad functionality. This notebook shows how to use functionality related to the Pinecone vector database. To use Pinecone, you must have an API key. Here are the installation instructions. pip install pinecone-client openai tiktoken langchain import os import getpass os.env...
https://python.langchain.com/docs/integrations/vectorstores/pinecone.html
b6ee642bdd58-1
query = "What did the president say about Ketanji Brown Jackson" docs = docsearch.similarity_search(query) print(docs[0].page_content) Adding More Text to an Existing Index​ More text can embedded and upserted to an existing Pinecone index using the add_texts function index = pinecone.Index("langchain-demo") vectorstor...
https://python.langchain.com/docs/integrations/vectorstores/pinecone.html
22fd32d5aebf-0
Page Not Found We could not find what you were looking for. Please contact the owner of the site that linked you to the original URL and let them know their link is broken.
https://python.langchain.com/docs/integrations/tools/dataforseo.ipynb
a3fa40b1a0f8-0
Epsilla Epsilla is an open-source vector database that leverages the advanced parallel graph traversal techniques for vector indexing. Epsilla is licensed under GPL-3.0. This notebook shows how to use the functionalities related to the Epsilla vector database. As a prerequisite, you need to have a running Epsilla vecto...
https://python.langchain.com/docs/integrations/vectorstores/epsilla.html
a3fa40b1a0f8-1
client = vectordb.Client() vector_store = Epsilla.from_documents( documents, embeddings, client, db_path="/tmp/mypath", db_name="MyDB", collection_name="MyCollection" ) query = "What did the president say about Ketanji Brown Jackson" docs = vector_store.similarity_search(query) print(docs[0].page_content) In state afte...
https://python.langchain.com/docs/integrations/vectorstores/epsilla.html
4af80e533c84-0
Dingo Dingo is a distributed multi-mode vector database, which combines the characteristics of data lakes and vector databases, and can store data of any type and size (Key-Value, PDF, audio, video, etc.). It has real-time low-latency processing capabilities to achieve rapid insight and response, and can efficiently co...
https://python.langchain.com/docs/integrations/vectorstores/dingo.html
4af80e533c84-1
# The OpenAI embedding model `text-embedding-ada-002 uses 1536 dimensions` docsearch = Dingo.from_documents(docs, embeddings, client=dingo_client, index_name=index_name) from langchain.embeddings.openai import OpenAIEmbeddings from langchain.text_splitter import CharacterTextSplitter from langchain.vectorstores import ...
https://python.langchain.com/docs/integrations/vectorstores/dingo.html
3c5d665cb1ad-0
This notebook goes over how to use the google search component. Then we will need to set some environment variables. "STATE OF HAWAII. 1 Child's First Name. (Type or print). 2. Sex. BARACK. 3. This Birth. CERTIFICATE OF LIVE BIRTH. FILE. NUMBER 151 le. lb. Middle Name. Barack Hussein Obama II is an American former poli...
https://python.langchain.com/docs/integrations/tools/google_search.html
b7342a218360-0
Golden provides a set of natural language APIs for querying and enrichment using the Golden Knowledge Graph e.g. queries such as: Products from OpenAI, Generative ai companies with series a funding, and rappers who invest can be used to retrieve structured data about relevant entities. The golden-query langchain tool i...
https://python.langchain.com/docs/integrations/tools/golden_query.html
b7342a218360-1
'properties': [{'predicateId': 'name', 'instances': [{'value': 'Analog Devices', 'citations': []}]}]}, {'id': 3941943, 'latestVersionId': 60382250, 'properties': [{'predicateId': 'name', 'instances': [{'value': 'AbbVie Inc.', 'citations': []}]}]}, {'id': 4178762, 'latestVersionId': 60542667, 'properties': [{'predicateI...
https://python.langchain.com/docs/integrations/tools/golden_query.html
1fe97ad24614-0
Google Drive Google Drive is a file storage and synchronization service developed by Google. This notebook covers how to load documents from Google Drive. Currently, only Google Docs are supported. Prerequisites​ Create a Google Cloud project or use an existing project Enable the Google Drive API Authorize credentials ...
https://python.langchain.com/docs/integrations/document_loaders/google_drive.html
1fe97ad24614-1
file_types=["document", "sheet"], recursive=False ) Passing in Optional File Loaders​ When processing files other than Google Docs and Google Sheets, it can be helpful to pass an optional file loader to GoogleDriveLoader. If you pass in a file loader, that file loader will be used on documents that do not have a Google...
https://python.langchain.com/docs/integrations/document_loaders/google_drive.html
1fe97ad24614-2
text/csv text/markdown image/png image/jpeg application/epub+zip application/pdf application/rtf application/vnd.google-apps.document (GDoc) application/vnd.google-apps.presentation (GSlide) application/vnd.google-apps.spreadsheet (GSheet) application/vnd.google.colaboratory (Notebook colab) application/vnd.openxmlform...
https://python.langchain.com/docs/integrations/document_loaders/google_drive.html
1fe97ad24614-3
print(doc.page_content.strip()[:60]+"...") You can customize your pattern. from langchain.prompts.prompt import PromptTemplate loader = GoogleDriveLoader( folder_id=folder_id, recursive=False, template=PromptTemplate( input_variables=["query", "query_name"], template="fullText contains '{query}' and name contains '{que...
https://python.langchain.com/docs/integrations/document_loaders/google_drive.html
1fe97ad24614-4
If you use the mode="snippet", only the description will be used for the body. Else, the metadata['summary'] has the field. Sometime, a specific filter can be used to extract some information from the filename, to select some files with specific criteria. You can use a filter. Sometimes, many documents are returned. It...
https://python.langchain.com/docs/integrations/document_loaders/google_drive.html
16055b24bdc6-0
Clarifai Clarifai is an AI Platform that provides the full AI lifecycle ranging from data exploration, data labeling, model training, evaluation, and inference. This example goes over how to use LangChain to interact with Clarifai models. To use Clarifai, you must have an account and a Personal Access Token (PAT) key....
https://python.langchain.com/docs/integrations/llms/clarifai.html
16055b24bdc6-1
llm_chain.run(question) 'Justin Bieber was born on March 1, 1994. So, we need to figure out the Super Bowl winner for the 1994 season. The NFL season spans two calendar years, so the Super Bowl for the 1994 season would have taken place in early 1995. \n\nThe Super Bowl in question is Super Bowl XXIX, which was played ...
https://python.langchain.com/docs/integrations/llms/clarifai.html
5339f238a30f-0
Clarifai Clarifai is an AI Platform that provides the full AI lifecycle ranging from data exploration, data labeling, model training, evaluation, and inference. This example goes over how to use LangChain to interact with Clarifai models. Text embedding models in particular can be found here. To use Clarifai, you must ...
https://python.langchain.com/docs/integrations/text_embedding/clarifai.html
1c82aba3dd99-0
Chroma Chroma is a AI-native open-source vector database focused on developer productivity and happiness. Chroma is licensed under Apache 2.0. Install Chroma with: Chroma runs in various modes. See below for examples of each integrated with LangChain. in-memory - in a python script or jupyter notebook in-memory with pe...
https://python.langchain.com/docs/integrations/vectorstores/chroma.html
1c82aba3dd99-1
Tonight. I call on the Senate to: Pass the Freedom to Vote Act. Pass the John Lewis Voting Rights Act. And while you’re at it, pass the Disclose Act so Americans can know who is funding our elections. Tonight, I’d like to honor someone who has dedicated his life to serve this country: Justice Stephen Breyer—an Army v...
https://python.langchain.com/docs/integrations/vectorstores/chroma.html
1c82aba3dd99-2
And I did that 4 days ago, when I nominated Circuit Court of Appeals Judge Ketanji Brown Jackson. One of our nation’s top legal minds, who will continue Justice Breyer’s legacy of excellence. Passing a Chroma Client into Langchain​ You can also create a Chroma Client and pass it to LangChain. This is particularly usefu...
https://python.langchain.com/docs/integrations/vectorstores/chroma.html
1c82aba3dd99-3
There are 3 in the collection Basic Example (using the Docker Container)​ You can also run the Chroma Server in a Docker container separately, create a Client to connect to it, and then pass that to LangChain. Chroma has the ability to handle multiple Collections of documents, but the LangChain interface expects one, ...
https://python.langchain.com/docs/integrations/vectorstores/chroma.html
1c82aba3dd99-4
And I did that 4 days ago, when I nominated Circuit Court of Appeals Judge Ketanji Brown Jackson. One of our nation’s top legal minds, who will continue Justice Breyer’s legacy of excellence. Update and Delete​ While building toward a real application, you want to go beyond adding data, and also update and delete data....
https://python.langchain.com/docs/integrations/vectorstores/chroma.html
1c82aba3dd99-5
# delete the last document print("count before", example_db._collection.count()) example_db._collection.delete(ids=[ids[-1]]) print("count after", example_db._collection.count()) {'source': '../../../state_of_the_union.txt'} {'ids': ['1'], 'embeddings': None, 'metadatas': [{'new_value': 'hello world', 'source': '../../...
https://python.langchain.com/docs/integrations/vectorstores/chroma.html
1c82aba3dd99-6
Tonight, I’d like to honor someone who has dedicated his life to serve this country: Justice Stephen Breyer—an Army veteran, Constitutional scholar, and retiring Justice of the United States Supreme Court. Justice Breyer, thank you for your service. One of the most serious constitutional responsibilities a President ...
https://python.langchain.com/docs/integrations/vectorstores/chroma.html
1c82aba3dd99-7
And I did that 4 days ago, when I nominated Circuit Court of Appeals Judge Ketanji Brown Jackson. One of our nation’s top legal minds, who will continue Justice Breyer’s legacy of excellence. Other Information​ Similarity search with score​ The returned distance score is cosine distance. Therefore, a lower score is bet...
https://python.langchain.com/docs/integrations/vectorstores/chroma.html
1c82aba3dd99-8
retriever.get_relevant_documents(query)[0] Document(page_content='Tonight. I call on the Senate to: Pass the Freedom to Vote Act. Pass the John Lewis Voting Rights Act. And while you’re at it, pass the Disclose Act so Americans can know who is funding our elections. \n\nTonight, I’d like to honor someone who has dedica...
https://python.langchain.com/docs/integrations/vectorstores/chroma.html
8c53260b7f7a-0
C Transformers The C Transformers library provides Python bindings for GGML models. This example goes over how to use LangChain to interact with C Transformers models. Install %pip install ctransformers Load Model from langchain.llms import CTransformers llm = CTransformers(model="marella/gpt-2-ggml") Generate Text pr...
https://python.langchain.com/docs/integrations/llms/ctransformers.html
f377837e56d2-0
Cohere Let's load the Cohere Embedding class. from langchain.embeddings import CohereEmbeddings embeddings = CohereEmbeddings(cohere_api_key=cohere_api_key) text = "This is a test document." query_result = embeddings.embed_query(text) doc_result = embeddings.embed_documents([text])
https://python.langchain.com/docs/integrations/text_embedding/cohere.html
09f1da0ed403-0
DashVector DashVector is a fully-managed vectorDB service that supports high-dimension dense and sparse vectors, real-time insertion and filtered search. It is built to scale automatically and can adapt to different application requirements. This notebook shows how to use functionality related to the DashVector vector ...
https://python.langchain.com/docs/integrations/vectorstores/dashvector.html
c4bc5254a360-0
SQL Database This notebook showcases an agent designed to interact with a SQL databases. The agent builds off of SQLDatabaseChain and is designed to answer more general questions about a database, as well as recover from errors. Note that, as this agent is in active development, all answers might not be correct. Additi...
https://python.langchain.com/docs/integrations/toolkits/sql_database.html
c4bc5254a360-1
SELECT * FROM "public"."users" JOIN "public"."user_permissions" ON "public"."users".id = "public"."user_permissions".user_id JOIN "public"."projects" ON "public"."users".id = "public"."projects".user_id JOIN "public"."events" ON "public"."projects".id = "public"."events".project_id; For a transactional SQL database, if...
https://python.langchain.com/docs/integrations/toolkits/sql_database.html
c4bc5254a360-2
> Entering new chain... Invoking: `list_tables_sql_db` with `{}` Album, Artist, Track, PlaylistTrack, InvoiceLine, sales_table, Playlist, Genre, Employee, Customer, Invoice, MediaType Invoking: `schema_sql_db` with `PlaylistTrack` CREATE TABLE "PlaylistTrack" ( "PlaylistId" INTEGER NOT NULL, "TrackId" INTEGER NO...
https://python.langchain.com/docs/integrations/toolkits/sql_database.html
c4bc5254a360-3
> Finished chain. 'The `PlaylistTrack` table has two columns: `PlaylistId` and `TrackId`. It is a junction table that represents the relationship between playlists and tracks. \n\nHere is the schema of the `PlaylistTrack` table:\n\n```\nCREATE TABLE "PlaylistTrack" (\n\t"PlaylistId" INTEGER NOT NULL, \n\t"TrackId"...
https://python.langchain.com/docs/integrations/toolkits/sql_database.html
c4bc5254a360-4
SELECT * FROM 'PlaylistTrack' LIMIT 3; PlaylistId TrackId 1 3402 1 3389 1 3390 Thought: I now know the final answer Final Answer: The PlaylistTrack table contains two columns, PlaylistId and TrackId, which are both integers and are used to link Playlist and Track tables. > Finished chain. 'The PlaylistTrack table...
https://python.langchain.com/docs/integrations/toolkits/sql_database.html
c4bc5254a360-5
SELECT * FROM 'Customer' LIMIT 3; CustomerId FirstName LastName Company Address City State Country PostalCode Phone Fax Email SupportRepId 1 Luís Gonçalves Embraer - Empresa Brasileira de Aeronáutica S.A. Av. Brigadeiro Faria Lima, 2170 São José dos Campos SP Brazil 12227-000 +55 (12) 3923-5555 +55 (12) 3923-5566 luisg...
https://python.langchain.com/docs/integrations/toolkits/sql_database.html
c4bc5254a360-6
SELECT * FROM 'Invoice' LIMIT 3; InvoiceId CustomerId InvoiceDate BillingAddress BillingCity BillingState BillingCountry BillingPostalCode Total 1 2 2009-01-01 00:00:00 Theodor-Heuss-Straße 34 Stuttgart None Germany 70174 1.98 2 4 2009-01-02 00:00:00 Ullevålsveien 14 Oslo None Norway 0171 3.96 3 8 2009-01-03 00:00:00 G...
https://python.langchain.com/docs/integrations/toolkits/sql_database.html
c4bc5254a360-7
> Entering new AgentExecutor chain... Action: list_tables_sql_db Action Input: "" Observation: Invoice, MediaType, Artist, InvoiceLine, Genre, Playlist, Employee, Album, PlaylistTrack, Track, Customer Thought: I should look at the schema of the Playlist and PlaylistTrack tables to see what columns I can use. Action: sc...
https://python.langchain.com/docs/integrations/toolkits/sql_database.html
c4bc5254a360-8
SELECT Playlist.Name, COUNT(PlaylistTrack.TrackId) AS TotalTracks FROM Playlist INNER JOIN PlaylistTrack ON Playlist.PlaylistId = PlaylistTrack.PlaylistId GROUP BY Playlist.Name Thought: The query looks correct, I can now execute it. Action: query_sql_db Action Input: SELECT Playlist.Name, COUNT(PlaylistTrack.TrackId) ...
https://python.langchain.com/docs/integrations/toolkits/sql_database.html
c4bc5254a360-9
> Entering new AgentExecutor chain... Action: list_tables_sql_db Action Input: "" Observation: MediaType, Track, Invoice, Album, Playlist, Customer, Employee, InvoiceLine, PlaylistTrack, Genre, Artist Thought: I should look at the schema of the Artist, InvoiceLine, and Track tables to see what columns I can use. Action...
https://python.langchain.com/docs/integrations/toolkits/sql_database.html
c4bc5254a360-10
CREATE TABLE "InvoiceLine" ( "InvoiceLineId" INTEGER NOT NULL, "InvoiceId" INTEGER NOT NULL, "TrackId" INTEGER NOT NULL, "UnitPrice" NUMERIC(10, 2) NOT NULL, "Quantity" INTEGER NOT NULL, PRIMARY KEY ("InvoiceLineId"), FOREIGN KEY("TrackId") REFERENCES "Track" ("TrackId"), FOREIGN KEY("InvoiceId") REFERENCES "Inv...
https://python.langchain.com/docs/integrations/toolkits/sql_database.html
c4bc5254a360-11
SELECT Artist.Name, SUM(InvoiceLine.Quantity) AS TotalQuantity FROM Artist INNER JOIN Track ON Artist.ArtistId = Track.ArtistId INNER JOIN InvoiceLine ON Track.TrackId = InvoiceLine.TrackId GROUP BY Artist.Name ORDER BY TotalQuantity DESC LIMIT 3; Thought: I now know the final answer. Action: query_sql_db Action ...
https://python.langchain.com/docs/integrations/toolkits/sql_database.html
747b1badf38c-0
This notebook goes over how to use the Google Serper component to search the web. First you need to sign up for a free account at serper.dev and get your api key. from langchain.utilities import GoogleSerperAPIWrapper from langchain.llms.openai import OpenAI from langchain.agents import initialize_agent, Tool from lang...
https://python.langchain.com/docs/integrations/tools/google_serper.html
747b1badf38c-1
self_ask_with_search = initialize_agent( tools, llm, agent=AgentType.SELF_ASK_WITH_SEARCH, verbose=True ) self_ask_with_search.run( "What is the hometown of the reigning men's U.S. Open champion?" ) If you would also like to obtain the results in a structured way including metadata. For this we will be using the result...
https://python.langchain.com/docs/integrations/tools/google_serper.html
747b1badf38c-2
'TV, plus explore accessories, entertainment, ...', 'sitelinks': [{'title': 'Support', 'link': 'https://support.apple.com/'}, {'title': 'iPhone', 'link': 'https://www.apple.com/iphone/'}, {'title': 'Site Map', 'link': 'https://www.apple.com/sitemap/'}, {'title': 'Business', 'link': 'https://www.apple.com/business/'}, {...
https://python.langchain.com/docs/integrations/tools/google_serper.html
747b1badf38c-3
'| Britannica', 'link': 'https://www.britannica.com/topic/Apple-Inc', 'snippet': 'Apple Inc., formerly Apple Computer, Inc., American ' 'manufacturer of personal computers, smartphones, ' 'tablet computers, computer peripherals, and computer ' '...', 'attributes': {'Related People': 'Steve Jobs Steve Wozniak Jony ' 'Iv...
https://python.langchain.com/docs/integrations/tools/google_serper.html
747b1badf38c-4
'you with your stock trading and investing.', 'position': 6}], 'peopleAlsoAsk': [{'question': 'What does Apple Inc do?', 'snippet': 'Apple Inc. (Apple) designs, manufactures and ' 'markets smartphones, personal\n' 'computers, tablets, wearables and accessories ' 'and sells a range of related\n' 'services.', 'title': 'A...
https://python.langchain.com/docs/integrations/tools/google_serper.html
747b1badf38c-5
'link': 'https://en.wikipedia.org/wiki/Tim_Cook'}], 'relatedSearches': [{'query': 'Who invented the iPhone'}, {'query': 'Apple iPhone'}, {'query': 'History of Apple company PDF'}, {'query': 'Apple company history'}, {'query': 'Apple company introduction'}, {'query': 'Apple India'}, {'query': 'What does Apple Inc own'},...
https://python.langchain.com/docs/integrations/tools/google_serper.html
747b1badf38c-6
'thumbnailWidth': 225, 'thumbnailHeight': 224, 'source': 'Encyclopedia Britannica', 'domain': 'www.britannica.com', 'link': 'https://www.britannica.com/animal/lion', 'position': 2}, {'title': 'African lion, facts and photos', 'imageUrl': 'https://i.natgeofe.com/n/487a0d69-8202-406f-a6a0-939ed3704693/african-lion.JPG', ...
https://python.langchain.com/docs/integrations/tools/google_serper.html
747b1badf38c-7
'position': 4}, {'title': 'How to Draw a Realistic Lion like an Artist - Studio ' 'Wildlife', 'imageUrl': 'https://studiowildlife.com/wp-content/uploads/2021/10/245528858_183911853822648_6669060845725210519_n.jpg', 'imageWidth': 1431, 'imageHeight': 2048, 'thumbnailUrl': 'https://encrypted-tbn0.gstatic.com/images?q=tbn...
https://python.langchain.com/docs/integrations/tools/google_serper.html
747b1badf38c-8
'other cool facts', 'imageUrl': 'https://www.gannett-cdn.com/-mm-/b2b05a4ab25f4fca0316459e1c7404c537a89702/c=0-0-1365-768/local/-/media/2022/03/16/USATODAY/usatsports/imageForEntry5-ODq.jpg?width=1365&height=768&fit=crop&format=pjpg&auto=webp', 'imageWidth': 1365, 'imageHeight': 768, 'thumbnailUrl': 'https://encrypted-...
https://python.langchain.com/docs/integrations/tools/google_serper.html
747b1badf38c-9
'position': 8}, {'title': "Lion | Smithsonian's National Zoo", 'imageUrl': 'https://nationalzoo.si.edu/sites/default/files/styles/1400_scale/public/animals/exhibit/africanlion-005.jpg?itok=6wA745g_', 'imageWidth': 1400, 'imageHeight': 845, 'thumbnailUrl': 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSgB3z_D4d...
https://python.langchain.com/docs/integrations/tools/google_serper.html
747b1badf38c-10
'of Robyn Denholm', 'link': 'https://www.reuters.com/business/autos-transportation/iss-recommends-tesla-investors-vote-against-re-election-robyn-denholm-2023-05-04/', 'snippet': 'Proxy advisory firm ISS on Wednesday recommended Tesla ' 'investors vote against re-election of board chair Robyn ' 'Denholm, citing "concern...
https://python.langchain.com/docs/integrations/tools/google_serper.html
747b1badf38c-11
'date': '6 hours ago', 'source': 'Bloomberg.com', 'imageUrl': 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcS_3Eo4VI0H-nTeIbYc5DaQn5ep7YrWnmhx6pv8XddFgNF5zRC9gEpHfDq8yQ&s', 'position': 3}, {'title': 'Joby Aviation to get investment from Tesla shareholder ' 'Baillie Gifford', 'link': 'https://finance.yahoo.com/...
https://python.langchain.com/docs/integrations/tools/google_serper.html
747b1badf38c-12
{'title': 'The Tesla Model 3 Long Range AWD Is Now Available in the ' 'U.S. With 325 Miles of Range', 'link': 'https://www.notateslaapp.com/news/1393/tesla-reopens-orders-for-model-3-long-range-after-months-of-unavailability', 'snippet': 'Tesla has reopened orders for the Model 3 Long Range ' 'RWD, which has been unava...
https://python.langchain.com/docs/integrations/tools/google_serper.html
747b1badf38c-13
'footprint in the Pacific Northwest.', 'date': '22 hours ago', 'source': 'The Business Journals', 'imageUrl': 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcR9kIEHWz1FcHKDUtGQBS0AjmkqtyuBkQvD8kyIY3kpaPrgYaN7I_H2zoOJsA&s', 'position': 8}, {'title': 'Tesla (TSLA) Resumes Orders for Model 3 Long Range After ' 'Bac...
https://python.langchain.com/docs/integrations/tools/google_serper.html
747b1badf38c-14
'a battery plant in Oklahoma, its third in...', 'date': '53 mins ago', 'source': 'Reuters', 'imageUrl': 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSSTcsXeenqmEKdiekvUgAmqIPR4nlAmgjTkBqLpza-lLfjX1CwB84MoNVj0Q&s', 'position': 1}, {'title': 'Ryder lanza solución llave en mano para vehículos ' 'eléctricos en EU...
https://python.langchain.com/docs/integrations/tools/google_serper.html
747b1badf38c-15
'source': 'THE BHARAT EXPRESS NEWS', 'imageUrl': 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcR_X9qqSwVFBBdos2CK5ky5IWIE3aJPCQeRYR9O1Jz4t-MjaEYBuwK7AU3AJQ&s', 'position': 3}]} qdr:h (past hour) qdr:d (past day) qdr:w (past week) qdr:m (past month) qdr:y (past year) You can specify intermediate time periods by...
https://python.langchain.com/docs/integrations/tools/google_serper.html
747b1badf38c-16
'longitude': -73.9642373, 'thumbnailUrl': 'https://lh5.googleusercontent.com/p/AF1QipNbNv6jZkJ9nyVi60__8c1DQbe_eEbugRAhIYye=w92-h92-n-k-no', 'rating': 4.5, 'ratingCount': 2265, 'category': 'Italian'}, {'position': 3, 'title': 'Caravaggio', 'address': '23 E 74th St', 'latitude': 40.773412799999996, 'longitude': -73.9647...
https://python.langchain.com/docs/integrations/tools/google_serper.html
747b1badf38c-17
{'position': 6, 'title': 'Come Prima', 'address': '903 Madison Ave', 'latitude': 40.772124999999996, 'longitude': -73.965012, 'thumbnailUrl': 'https://lh5.googleusercontent.com/p/AF1QipNrX19G0NVdtDyMovCQ-M-m0c_gLmIxrWDQAAbz=w92-h92-n-k-no', 'rating': 4.5, 'ratingCount': 176, 'category': 'Italian'}, {'position': 7, 'tit...
https://python.langchain.com/docs/integrations/tools/google_serper.html
747b1badf38c-18
'rating': 4.5, 'ratingCount': 113, 'category': 'Italian'}, {'position': 10, 'title': 'Barbaresco', 'address': '843 Lexington Ave #1', 'latitude': 40.7654332, 'longitude': -73.9656873, 'thumbnailUrl': 'https://lh5.googleusercontent.com/p/AF1QipMb9FbPuXF_r9g5QseOHmReejxSHgSahPMPJ9-8=w92-h92-n-k-no', 'rating': 4.3, 'ratin...
https://python.langchain.com/docs/integrations/tools/google_serper.html
60b23f2519bc-0
Hugging Face Hub Let's load the Hugging Face Embedding class. from langchain.embeddings import HuggingFaceEmbeddings embeddings = HuggingFaceEmbeddings() text = "This is a test document." query_result = embeddings.embed_query(text) doc_result = embeddings.embed_documents([text])
https://python.langchain.com/docs/integrations/text_embedding/huggingfacehub.html