-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
docs: update tutorials #7358
base: main
Are you sure you want to change the base?
docs: update tutorials #7358
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Skipped Deployment
|
This reverts commit 36497ec.
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.
Thank you so much for this!
@@ -61,6 +61,18 @@ | |||
"source": "/docs/integrations/llms/togetherai(/?)", | |||
"destination": "/docs/integrations/llms/together/" | |||
}, | |||
{ | |||
"source": "/docs/tutorials/query_analysis(/?)", | |||
"destination": "/docs/tutorials/rag#query-analysis/" |
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 don't think this hash will do anything since this happens on the backend - not sure though
"- [Prompt Templates](/docs/concepts/prompt_templates)\n", | ||
"- [Chat History](/docs/concepts/chat_history)\n", | ||
"\n", | ||
"This guide requires `langgraph >= 0.2.28`.\n", |
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.
If we are moving all this to use LangGraph, should we just work towards combine docs?
Not in this PR obviously but in general
"\n", | ||
"This guide (and most of the other guides in the documentation) uses [Jupyter notebooks](https://jupyter.org/) and assumes the reader is as well. Jupyter notebooks are perfect for learning how to work with LLM systems because oftentimes things can go wrong (unexpected output, API down, etc) and going through guides in an interactive environment is a great way to better understand them.\n", | ||
"\n", | ||
"This and other tutorials are perhaps most conveniently run in a Jupyter notebook. See [here](https://jupyter.org/install) for instructions on how to install.\n", |
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.
Can be in a followup but we should have a guide on how to set up TSLab since it's not a typical experience for JS devs
"\n", | ||
"const promptTemplate = ChatPromptTemplate.fromMessages([\n", | ||
" [\"system\", \"You talk like a pirate. Answer all questions to the best of your ability.\"],\n", | ||
" new MessagesPlaceholder(\"messages\"),\n", |
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.
nit: use shorthand:
["placeholder", "{messages}"],
But also, should we just be using a function rather than a prompt template?
"})\n", | ||
"\n", | ||
"const messages = [\n", | ||
" new SystemMessage(\"you're a good assistant\"),\n", |
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.
Should we just make these OpenAI dicts to remove the need to import?
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"const structuredLlm = llm.withStructuredOutput({\n", |
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.
nit: prefer Zod?
"import { StateGraph } from \"@langchain/langgraph\";\n", | ||
"\n", | ||
"const graphBuilder = new StateGraph({\n", | ||
" input: InputStateAnnotation,\n", |
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.
See above, we don't need all 3 declared here
"const prettyPrint = (message: BaseMessage) => {\n", | ||
" let txt = `[${message._getType()}]: ${message.content}`;\n", | ||
" if (\n", | ||
" (isAIMessage(message) && (message as AIMessage)?.tool_calls?.length) ||\n", |
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.
See above, you shouldn't need the cast
"source": [ | ||
"## Stuff: summarize in a single LLM call {#stuff}\n", | ||
"\n", | ||
"We can use [create_stuff_documents_chain](https://python.langchain.com/api_reference/langchain/chains/langchain.chains.combine_documents.stuff.create_stuff_documents_chain.html), especially if using larger context window models such as:\n", |
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.
Update to JS equivalents
"}\n", | ||
"\n", | ||
"// Here we generate a summary, given a document\n", | ||
"const generateSummary = async (state: SummaryState): Promise<{ summaries: string[] }> => {\n", |
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.
Why declare another type here?
Following langchain-ai/langchain#28219