id stringlengths 16 145 | text stringlengths 1 179k | title stringclasses 1
value |
|---|---|---|
langchain/langchaindecodedpart_54_0.txt | In addition to truncation, I mentioned chunking as a method to deal with large
text inputs. However, to search over many vectors quickly, repeatedly calling
OpenAI embedding models is neither efficient nor cost effective. Instead, you
should use vector databases like Chroma, Weaviate, Pinecone, Qdrant, Milvus,
and othe... | |
langchain/langchain101part3bta_234_0.txt | __ Editorial ↓ | |
langchain/langchain101part3bta_40_0.txt | Adding an additional dimension allowed us to split the vehicles into potential
subgroups. Instead of drawing more and more dimensions, let’s take a look at a
potential table: | |
langchain/LangChain_23_10.txt | stopher Nolan and he is 52 years old. His age in days is approximately 18980 days."
}
'The director of the 2023 film Oppenheimer is Christopher Nolan and he is 52 years old. His age in days is approximately 18980 days.'
### ` set_verbose(True) `
Setting... | |
langchain/langchain101part3bta_176_0.txt | ### [ Top Important Computer Vision Papers for the Week from 22/04 to 28/04
](https://towardsai.net/p/machine-learning/top-important-computer-vision-
papers-for-the-week-from-22-04-to-28-04) | |
langchain/langchaindecodedpart_48_0.txt | max_tokens = 8191
encoding_name = 'cl100k_base' | |
langchain/textembedding_45_0.txt | embeddings_model = OpenAIEmbeddings() | |
langchain/retrievalinlangchain_2_0.txt | [ Sign in
](/m/signin?operation=login&redirect=https%3A%2F%2Fmedium.com%2F%40sushmithabhanu24%2Fretrieval-
in-langchain-part-3-text-embeddings-and-vector-
stores-f8be7fb0508a&source=post_page---two_column_layout_nav
-----------------------global_nav-----------) | |
langchain/retrievalinlangchain_30_0.txt | Various embedding models perform better than the OpenAIEmbedding model such as
the BGE model created by the BAAI on HuggingFace is the best open-source
embedding model. | |
langchain/langchain101part3bta_266_0.txt | Others | |
langchain/langchaindecodedpart_31_0.txt | LangChain also offers a FakeEmbeddings class to test your pipeline without
making actual calls to the embedding providers. | |
langchain/langchain101part3bta_16_0.txt | # LangChain 101: Part 3b. Talking to Documents: Embeddings and Vectorstores | |
langchain/langchain101part3bta_192_0.txt | [ 
](https://towardsai.net/p/statistics/descriptive-statistics-21fc0196c1df
"Descriptive Statistics for Data-driven Decision Making with Python") | |
langchain/LangChain_20_0.txt | Skip to main content
[   ](/) [ Docs
](/docs/get_started/introduction) [ Use cases ](/docs/use_cases) [
Integrations ](/docs/integrations/platforms/) [ Guides
](/docs/guides/debugging) [ API ](https://api.python.langchain.com)
... | |
langchain/langchain101part3bta_13_0.txt | * [ Home ](https://towardsai.net/)
* [ Latest ](https://towardsai.net/ai/l)
* LangChain 101: Part 3b. Talking to Documents: Embeddings and Vectorstores | |
langchain/LangChain_43_1.txt | ding data as documents from a
configured source. They optionally implement a "lazy load" as well for lazily
loading data into memory.
## Get started
The simplest loader reads in a file as text and places it all into one
document.
from langchain_community.document_loaders import TextLoader
... | |
langchain/langchain101part3bta_260_0.txt | Analytics | |
langchain/LangChain_29_0.txt | Skip to main content
[   ](/) [ Docs
](/docs/get_started/introduction) [ Use cases ](/docs/use_cases) [
Integrations ](/docs/integrations/platforms/) [ Guides
](/docs/guides/debugging) [ API ](https://api.python.langchain.com)
... | |
langchain/LangChain_41_1.txt | e14913caff5f379f80f305aab&v=4)
](https://github.com/Undertone0809) [ @ Undertone0809
](https://github.com/Undertone0809)
[ 
](https://github.com/scadEfUr) [ @ scadEfUr ](https://github.com/scadEfUr)
[

](https://towardsai.net/p/machine-learning/nlp-news-cypher-10-11-20-2 "NLP
News Cypher | 10.11.20") | |
langchain/LangChain_36_1.txt | angChain.js. Hit the ground running using Templates for reference.
* **Productionize** : Use LangSmith to inspect, test and monitor your chains, so that you can constantly improve and deploy with confidence.
* **Deploy** : Turn any chain into an API with LangServe.
## LangChain Libraries
The main value pro... | |
langchain/retrievalinlangchain_0_0.txt | [ Open in app
](https://rsci.app.link/?%24canonical_url=https%3A%2F%2Fmedium.com%2Fp%2Ff8be7fb0508a&%7Efeature=LoOpenInAppButton&%7Echannel=ShowPostUnderUser&source=---two_column_layout_nav----------------------------------) | |
langchain/langchain101part3bta_125_0.txt | chroma_db.max_marginal_relevance_search(query, k=5, fetch_k=10) | |
langchain/langchain101part3bta_141_0.txt | There are tons of [ vectorstore integrations in Langchain
](https://python.langchain.com/docs/integrations/vectorstores) , and it’s
awesome because it’s unified — you can easily swap a vectorstore to check if
another suits you best. | |
langchain/langchain101part3bta_124_0.txt | A technique that can be implemented is MMR, short for Maximum Marginal
Relevance. The idea is that you return the closest k chunks that are different
from other chunks. | |
langchain/LangChain_6_9.txt | ement this type of design.
* [ Basic Reflection ](https://github.com/langchain-ai/langgraph/tree/main/examples/reflection/reflection.ipynb) : add a simple "reflect" step in your graph to prompt your system to revise its outputs.
* [ Reflexion ](https://github.com/langchain-ai/langgraph/tree/main/examples/reflexio... | |
langchain/retrievalinlangchain_78_0.txt | Data Science enthusiast | |
langchain/LangChain_10_9.txt | ------------------
RunLog({'final_output': 'Harrison worked at Kens',
'id': '431d1c55-7c50-48ac-b3a2-2f5ba5f35172',
'logs': {'Docs': {'end_time': '2024-01-19T22:33:57.120+00:00',
'final_output': {'documents': [Document(page_content='harrison worked at kensho')]},
... | |
langchain/LangChain_35_1.txt | support for self-querying.
A self-querying retriever is one that, as the name suggests, has the ability
to query itself. Specifically, given any natural language query, the retriever
uses a query-constructing LLM chain to write a structured query and then
applies that structured query to its underlying VectorStore. Th... | |
langchain/langchaindecodedpart_44_0.txt | truncated_text = long_text[:max_tokens] | |
langchain/langchain101part3bta_35_0.txt | Embeddings are numerical representations of various forms of content, mostly,
but not limited to text and images. These arrays of numbers encapsulate the
semantic meanings of their real-world counterparts. From a stereometrical
perspective, embeddings represent content within a multi-dimensional space,
each point’s pos... | |
langchain/langchain101part3bta_72_0.txt | _list = [mpnet_embeddings.embed_query(s) for s in sentences] | |
langchain/LangChain_10_10.txt | ''],
'type': 'chain'})
## Parallelism
Let’s take a look at how LangChain Expression Language supports parallel
requests. For example, when using a ` RunnableParallel ` (often written as a
dictionary) it executes each element in parallel.
from langchain_core.runnables import RunnablePa... | |
langchain/textembedding_70_0.txt | [0.0053587136790156364,
-0.0004999046213924885,
0.038883671164512634,
-0.003001077566295862,
-0.00900818221271038] | |
langchain/langchain101part3bta_173_0.txt | [ __ 1 like ](https://towardsai.net/wp-admin/admin-
ajax.php?action=process_simple_like&post_id=32847&nonce=a9dade1234&is_comment=0&disabled=true
"Unlike") | |
langchain/langchain101part3bta_241_0.txt | * [ __ ](https://news.google.com/publications/CAAqBwgKMNiLmgswgpayAw)
* [ __ ](https://medium.com/towards-artificial-intelligence)
* [ __ ](https://www.facebook.com/towardsAl/)
* [ __ ](https://twitter.com/towards_ai?lang=en)
* [ __ ](https://linkedin.com/company/towards-artificial-intelligence)
* [ __ ](https://instag... | |
langchain/langchain101part3bta_265_0.txt | Others | |
langchain/LangChain_31_0.txt | Skip to main content
[   ](/) [ Docs
](/docs/get_started/introduction) [ Use cases ](/docs/use_cases) [
Integrations ](/docs/integrations/platforms/) [ Guides
](/docs/guides/debugging) [ API ](https://api.python.langchain.com)
... | |
langchain/LangChain_1_2.txt | archStore(
es_url="http://localhost:9200", index_name="test_index", embedding=embedding
)
Initialize a record manager with an appropriate namespace.
**Suggestion:** Use a namespace that takes into account both the vector store
and the collection name in the vector store; e.g., ‘redis/my_docs’,
... | |
langchain/retrievalinlangchain_47_0.txt | #Creating a vector database (FAISS - in memory database)
db = FAISS.from_documents(
docs,
embedding_function
) | |
langchain/LangChain_29_1.txt | ing.
## [ ChatModels ](/docs/modules/model_io/chat/)
[ This section ](/docs/modules/model_io/chat/) covers functionality related to
the ChatModel class. This is a type of model that takes a list of messages as
input and returns a message.
## [ Output Parsers ](/docs/modules/model_io/output_parsers/)
Output pa... | |
langchain/textembedding_8_0.txt | * [ Model I/O ](/docs/modules/model_io/) | |
langchain/textembedding_79_0.txt | More | |
langchain/textembedding_22_0.txt | * [ Components ](/docs/modules/) | |
langchain/textembedding_30_0.txt | The base Embeddings class in LangChain provides two methods: one for embedding
documents and one for embedding a query. The former takes as input multiple
texts, while the latter takes a single text. The reason for having these as
two separate methods is that some embedding providers have different embedding
methods fo... | |
langchain/langchaindecodedpart_20_0.txt | The LangChain Embedding class is designed as an interface for embedding
providers like OpenAI, Cohere, HuggingFace etc. The base class exposes two
methods ` embed_query ` and ` embed_documents ` \- the former works over a
single document, while the latter can work across multiple documents. | |
langchain/LangChain_17_1.txt | le server
* ` /stream_log/ ` endpoint for streaming all (or some) intermediate steps from your chain/agent
* **new** as of 0.0.40, supports ` astream_events ` to make it easier to stream without needing to parse the output of ` stream_log ` .
* Playground page at ` /playground/ ` with streaming output and inte... | |
langchain/LangChain_6_2.txt | y" ` that will take the
result of the most recent message, if it is a tool call, and calculate the
result. We'll also bind the calculator to the OpenAI model as a tool to allow
the model to optionally use the tool necessary to respond to the current
state:
import json
from langchain_core.messages i... | |
langchain/textembedding_27_0.txt | Head to [ Integrations ](/docs/integrations/text_embedding/) for documentation
on built-in integrations with text embedding model providers. | |
langchain/LangChain_10_6.txt | f the sub-run."""
name: str
"""Name of the object being run."""
type: str
"""Type of the object being run, eg. prompt, chain, llm, etc."""
tags: List[str]
"""List of tags for the run."""
metadata: Dict[str, Any]
"""Key-value pairs of metada... | |
langchain/langchain101part3bta_221_0.txt | [ 
](https://towardsai.net/p/machine-learning/unboxing-loss-functions-in-yolov8
"Unboxing Loss Functions in YOLOv8") | |
langchain/langchain101part3bta_268_0.txt | SAVE & ACCEPT | |
langchain/LangChain_26_1.txt | e this is beneficial. LangChain has a base `
MultiVectorRetriever ` which makes querying this type of setup easy. A lot of
the complexity lies in how to create the multiple vectors per document. This
notebook covers some of the common ways to create those vectors and use the `
MultiVectorRetriever ` .
The methods to c... | |
langchain/langchain101part3bta_126_0.txt | # or | |
langchain/LangChain_23_7.txt | ``\nAnswer: ${Answer}\n\nBegin.\n\nQuestion: What is 37593 * 67?\n```text\n37593 * 67\n```\n...numexpr.evaluate(\"37593 * 67\")...\n```output\n2518731\n```\nAnswer: 2518731\n\nQuestion: 37593^(1/5)\n```text\n37593**(1/5)\n```\n...numexpr.evaluate(\"37593**(1/5)\")...\n```output\n8.222831614237718\n```\nAnswer: 8.222831... | |
langchain/LangChain_23_4.txt | num.chain:LLMChain] [4.46s] Exiting Chain run with output:
{
"text": "The director of the 2023 film Oppenheimer is Christopher Nolan. Now I need to find out his age.\nAction: duckduckgo_search\nAction Input: \"Christopher Nolan age\""
}
[tool/start] [1:RunTypeEnum.chain:AgentEx... | |
langchain/LangChain_19_4.txt | MMathChain.html#langchain.chains.llm_math.base.LLMMathChain) | | | This chain converts a user question to a math problem and then executes it (using [ numexpr ](https://github.com/pydata/numexpr) )
[ LLMCheckerChain ](https://api.python.langchain.com/en/latest/chains/langchain.chains.llm_checker.base.LLMCheckerCh... | |
langchain/langchaindecodedpart_37_0.txt | # Request with context length > 8191 throws an error
from langchain.embeddings import OpenAIEmbeddings | |
langchain/LangChain_10_4.txt | tool'],
'type': 'string'},
'tool_call_id': {'title': 'Tool Call Id', 'type': 'string'}},
'required': ['content', 'tool_call_id']}}}
## Stream
for s in chain.stream({"topic": "bears"}):
print(s.content, end="", flush=True)
Sure, here... | |
langchain/textembedding_6_0.txt | [ 💬 ](https://chat.langchain.com) [ ](https://github.com/langchain-
ai/langchain) | |
langchain/LangChain_39_1.txt | f documents (HTML, PDF, code) from
all types of locations (private S3 buckets, public websites).
**[ Text Splitting ](/docs/modules/data_connection/document_transformers/) **
A key part of retrieval is fetching only the relevant parts of documents. This
involves several transformation steps to prepare the documents f... | |
langchain/LangChain_20_1.txt | ting, formatting, and
documentation standards in the codebase. If you are finding these difficult
(or even just annoying) to work with, feel free to contact a maintainer for
help - we do not want these to get in the way of getting good code into the
codebase.
# 🌟 Recognition
If your contribution has made its way in... | |
langchain/langchain101part3bta_150_0.txt | ## LangChain 101 Course (updated) | |
langchain/retrievalinlangchain_11_0.txt | [ Sushmitha ](/@sushmithabhanu24?source=post_page-----
f8be7fb0508a--------------------------------) | |
langchain/retrievalinlangchain_86_0.txt | ](/about?autoplay=1&source=post_page-----
f8be7fb0508a--------------------------------) | |
langchain/langchain101part3bta_229_0.txt | * [ Home ](https://towardsai.net/)
* [ About ](https://towardsai.net/about)
* [ Publication ](https://towardsai.net/p)
* [ Sponsors ](https://sponsors.towardsai.net)
* [ For Authors ](https://contribute.towardsai.net/)
* [ Editorial ](https://towardsai.net/ai/editorial)
* [ News ](https://towardsai.net/ai/news)
* [ AI ... | |
langchain/LangChain_6_6.txt | y 2024. You can drill down from year to month and even day level reports by clicking on the graphs.'}]", name='tavily_search_results_json'), AIMessage(content="I couldn't find the current weather in San Francisco. However, you can visit [WeatherSpark](https://weatherspark.com/h/m/557/2024/1/Historical-Weather-in-Januar... | |
langchain/langchain101part3bta_103_0.txt | docs = db.similarity_search_with_score(query) | |
langchain/langchaindecodedpart_35_0.txt | query_result = embeddings.embed_query(text)
print(query_result)
print(len(query_result)) | |
langchain/langchain101part3bta_246_0.txt | Close | |
langchain/LangChain_33_1.txt | vant_documents() ` methods and rerank the results
based on the [ Reciprocal Rank Fusion
](https://plg.uwaterloo.ca/~gvcormac/cormacksigir09-rrf.pdf) algorithm.
By leveraging the strengths of different algorithms, the ` EnsembleRetriever `
can achieve better performance than any single algorithm.
The most common patte... | |
langchain/langchain101part3bta_74_0.txt | _list = gist_embedding.encode(sentences, convert_to_tensor=True) | |
langchain/LangChain_5_1.txt | ved documents. In brief: When models
must access relevant information in the middle of long contexts, they tend to
ignore the provided documents. See: [ https://arxiv.org/abs/2307.03172
](https://arxiv.org/abs/2307.03172)
To avoid this issue you can re-order documents after retrieval to avoid
performance degradation.
... | |
langchain/LangChain_10_0.txt | Skip to main content
[   ](/) [ Docs
](/docs/get_started/introduction) [ Use cases ](/docs/use_cases) [
Integrations ](/docs/integrations/platforms/) [ Guides
](/docs/guides/debugging) [ API ](https://api.python.langchain.com)
... | |
langchain/textembedding_26_0.txt | info | |
langchain/langchain101part3bta_237_0.txt | __ Advertising/Sponsors ↓ | |
langchain/textembedding_66_0.txt |
### ` embed_query ` | |
langchain/retrievalinlangchain_13_0.txt | 4 min read | |
langchain/langchaindecodedpart_18_0.txt | ### LangChain: Text Embeddings | |
langchain/langchain101part3bta_20_0.txt | Share this post | |
langchain/retrievalinlangchain_70_0.txt | \-- | |
langchain/langchain101part3bta_60_0.txt | [ ](/langchain-101-part-2ab-all-you-need-to-know-about-large-language-
models-3512ae41dfc3?source=post_page-----
c37d460f1519--------------------------------) | |
langchain/retrievalinlangchain_84_0.txt | ](https://medium.statuspage.io/?source=post_page-----
f8be7fb0508a--------------------------------) | |
langchain/langchaindecodedpart_64_0.txt | ### Subscribe to alphasec | |
langchain/langchain101part3bta_213_0.txt | ##### [ The Role of AI and Algorithms in Social Media
](https://towardsai.net/p/machine-learning/the-role-of-ai-and-algorithms-in-
social-media "The Role of AI and Algorithms in Social Media") | |
langchain/LangChain_35_3.txt | ect formatted in the following schema:
```json
{
"query": string \ text string to compare to document contents
"filter": string \ logical condition statement for filtering documents
}
```
The query string should contain only text that is expected to match ... | |
langchain/LangChain_10_7.txt | ---------------------------------
RunLogPatch({'op': 'add', 'path': '/streamed_output/-', 'value': ' at'},
{'op': 'replace', 'path': '/final_output', 'value': 'Harrison worked at'})
----------------------------------------
RunLogPatch({'op': 'add', 'path': '/streamed_output/-', 'value': ' Kens'... | |
langchain/LangChain_26_4.txt | og ](https://blog.langchain.dev)
* [ YouTube ](https://www.youtube.com/@LangChain)
Copyright © 2024 LangChain, Inc.
| |
langchain/LangChain_6_8.txt | nent
* [ Force calling a tool first ](https://github.com/langchain-ai/langgraph/blob/main/examples/chat_agent_executor_with_function_calling/force-calling-a-tool-first.ipynb) : How to always call a specific tool first
* [ Respond in a specific format ](https://github.com/langchain-ai/langgraph/blob/main/examples/... | |
langchain/LangChain_27_0.txt | Skip to main content
[   ](/) [ Docs
](/docs/get_started/introduction) [ Use cases ](/docs/use_cases) [
Integrations ](/docs/integrations/platforms/) [ Guides
](/docs/guides/debugging) [ API ](https://api.python.langchain.com)
... | |
langchain/langchain101part3bta_7_0.txt | 5 stars – based on 497 reviews | |
langchain/retrievalinlangchain_51_0.txt | db = Chroma.from_documents(docs, embedding_function, persist_directory=output_path)
laoded_db = Chroma(persist_directory=output_path, embedding_function=embedding_function) | |
langchain/retrievalinlangchain_83_0.txt | Status | |
langchain/langchain101part3bta_51_0.txt | [ ](https://huggingface.co/spaces/mteb/leaderboard?source=post_page-----
c37d460f1519--------------------------------) | |
langchain/textembedding_23_0.txt | * [ ](/)
* [ Retrieval ](/docs/modules/data_connection/)
* Embedding models | |
langchain/langchain101part3bta_228_0.txt | ## Company | |
langchain/LangChain_40_2.txt | page:
[ Previous PDF ](/docs/modules/data_connection/document_loaders/pdf) [ Next
HTMLHeaderTextSplitter
](/docs/modules/data_connection/document_transformers/HTML_header_metadata)
* Types of Text Splitters
* Evaluate text splitters
* Other Document Transforms
Community
* [ Discord ](https://discord.... | |
langchain/langchain101part3bta_249_0.txt | Necessary | |
langchain/langchain101part3bta_136_0.txt | retriever = SelfQueryRetriever.from_llm(
llm,
chroma_db,
document_content_description,
metadata_field_info,
verbose=True
) | |
langchain/retrievalinlangchain_95_0.txt | Text to speech |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.