-
Notifications
You must be signed in to change notification settings - Fork 15k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
First draft of concept pages #27088
base: concept_docs
Are you sure you want to change the base?
First draft of concept pages #27088
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
docs/docs/concepts.mdx
Outdated
@@ -522,120 +522,6 @@ for modifying **multiple** key-value pairs at once: | |||
|
|||
For key-value store implementations, see [this section](/docs/integrations/stores/). | |||
|
|||
### Tools |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rlancemartin shall we keep the section headings everywhere to maintain a glossary on the main concepts page?
We can remove the beefy content, but maintain headings so no links break
docs/docs/concepts/tool_calling.mdx
Outdated
|
||
Many AI applications interact directly with humans (e.g., chatbots). In these cases, it is approrpiate for models to respond in natural langague. | ||
|
||
But what about cases where we want a model to interact *directly* with another system (e.g., a databases or an API)? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
another
vs. additional
or some other paraphrasing to mean that the AI can interact with the human AND an external system
docs/docs/concepts/tool_calling.mdx
Outdated
|
||
`ChatModel.bind_tools()` is a method for specifying which tools are available for a model to call. | ||
|
||
If a model has been initialized as `llm` without tools, we can bind tools to it as a list: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to be more precise about chat model vs. llm terminology? We use them interchangeably in docs, but can be confusing?
We could also opt for favoring model
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is good point that i'm also wary of --
1/ maybe we defer to model
by default
2/ conceptual guide on llm
and chat model
call out each specifically
docs/docs/concepts/tool_calling.mdx
Outdated
|
||
For more details on usage, see our [how-to guides](docs/how_to/#tools)! | ||
|
||
## Common patterns |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This section is a nice addition, not sure if i've seen this discussion before.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ya -- we use this same framing in the course.
@@ -0,0 +1,133 @@ | |||
# Tool Calling |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need a URL that we can link to that explains what a Tool is / brief example of definition/ brief example of how it can be used.
I think we need another page for tools specifically, or else retitle this page to `# Tools and have a tool calling section somewhere within it?
Some of the questions that the conceptual guide should address:
- What is a tool?
- Where is the tool getting executed? (maybe does a tool code need to be executed?)
- How does one define a tool? (We have 4-5 ways of doing it); e.g., @tool decorator, StructuredTool.from_function..... We don't need to do it in detail, but can link to the how-to guide, but just explain high level what the differences are.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's true. let me try to add as a section on this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also noted in Slack discussion. this is a good thing to flesh out --
https://langchain.slack.com/archives/C04GWPE38LV/p1728407895162059
|
||
## Motivation | ||
|
||
While many AI applications, such as chatbots, typically respond in natural language, there are scenarios where we need models to output in a structured format. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe this?
While many AI applications, such as chatbots, typically respond in natural language, there are scenarios where we need models to output in a structured format. | |
While many AI applications, such as chatbots, typically respond in natural language, there are scenarios where we need models to output a response matching a specific structured format. |
|
||
## Indexing Strategies | ||
|
||
Documents needed to be indexed, frequently using embedding models to [compress the semantic information in documents to fixed-size vectors](/docs/concepts/#embedding-models). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Has the term "Documents" been defined yet?
- Should we use the more general term of "Content" or something along those lines so it's clear that conceptually some ideas carry to other modalities?
|
||
But chunk size and chunk number can be difficult to set and affect results if they do not provide full context for the LLM to answer a question. | ||
|
||
Furthermore, LLMs are increasingly capable of processing millions of tokens. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Latency is important for many applications.
Pulling in the content of the top 10 search hits can add significant latency.
In an extreme case, all 10 hits come from different documents.
In many domains, document length can run into the hundreds of pages (i've dozens if not hundreds of thousand page long documents in finance)
Even if the llm context window were unlimited (and could incorporate information from the context perfectly), implementation details still introduce a tradeoff in terms of latency.
Is a user willing to wait for an extra 5-60 seconds to get an answer from a chat system? This ends up being very use case dependent.
|
||
In some cases, irrelevant or redundant content can dilute the semantic usefulness of the embedding. | ||
|
||
[ColBERT](https://docs.google.com/presentation/d/1IRhAdGjIevrrotdplHNcc4aXgIYyKamUKTWtB3m3aMU/edit?usp=sharing) is an interesting approach to address this with a higher granularity embeddings: (1) produce a contextually influenced embedding for each token in the document and query, (2) score similarity between each query token and all document tokens, (3) take the max, (4) do this for all query tokens, and (5) take the sum of the max scores (in step 3) for all query tokens to get a query-document similarity score; this token-wise scoring can yield strong results. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This section is describing how to implement the algorithm, but it's not explaining what the algorithm does at a conceptual level. I think most readers will gloss over this description as a result since it's not conceptual.
It would be helpful to have a sentence in the spirit of: a variation that generates multiple embeddings for the query, and retrieves closest documents to any of these embeddings
|
||
Language models (LLMs) are trained on vast but fixed datasets, which limits their ability to access up-to-date or domain-specific information. | ||
|
||
To enhance their performance on specific tasks, we can augment their knowledge using retrieval systems. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"retrieval systems" => external information (see other related comment)
In LangChain, any function can be bound as a tool. | ||
|
||
```python | ||
def multiply(a: int, b: int) -> int: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe we usually need a @tool
decorator (since some code probably assumes that the tool is a runnable) at invocation time
def multiply(a: int, b: int) -> int: | |
def multiply(a: int, b: int) -> int: |
No description provided.