-
Notifications
You must be signed in to change notification settings - Fork 1
LangChain: Starter tutorial #292
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
Conversation
WalkthroughRenames the Integrations anchor, replaces a LangChain tutorial badge with a Sphinx cross-reference and hidden toctree, and adds a new LangChain tutorial page that documents setup, examples, and a LangChain→CrateDB workflow. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor User
participant Docs as Docs (Tutorial)
participant Agent as LangChain Agent
participant LLM as LLM Provider
participant Toolkit as SQLDatabase / Toolkit
participant Crate as CrateDB
User->>Docs: Follow tutorial steps
Docs->>Toolkit: Initialize SQLDatabase.from_uri / Toolkit
Toolkit->>Crate: Inspect schema / fetch metadata
Crate-->>Toolkit: Schema & tables
User->>Agent: Ask natural-language question
Agent->>LLM: Plan / generate SQL
LLM-->>Agent: Proposed SQL
Agent->>Toolkit: Execute SQL
Toolkit->>Crate: Run query
Crate-->>Toolkit: Result rows
Toolkit-->>Agent: Results
Agent-->>User: Final answer
note right of Agent: Warning: watch data exposure (production)
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10–15 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (3)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
Tip 👮 Agentic pre-merge checks are now available in preview!Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.
Please see the documentation for more information. Example: reviews:
pre_merge_checks:
custom_checks:
- name: "Undocumented Breaking Changes"
mode: "warning"
instructions: |
Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).Please share your feedback with us on this Discord post. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@coderabbitai review. It looks like this has been written in active voice already? Great. Otherwise, please suggest adjustments. |
🧩 Analysis chainBased on the information gathered, I can see this PR adds a LangChain tutorial but I need to examine the actual content to review the voice usage. Let me try to access the files mentioned in the PR. Let me try to get the actual file content from the PR: @amotl I'll review the PR for active voice usage. Let me trigger a comprehensive review of the changes to check for voice and provide specific suggestions if needed. 🏁 Script executed: Length of output: 94 🏁 Script executed: Length of output: 5366 🏁 Script executed: Length of output: 354 🏁 Script executed: Length of output: 70 🏁 Script executed: Length of output: 2668 🏁 Script executed: Length of output: 291 🏁 Script executed: Length of output: 449 🏁 Script executed: Length of output: 673 🏁 Script executed: Length of output: 7779 🏁 Script executed: Length of output: 604 🏁 Script executed: Length of output: 53 🏁 Script executed: Length of output: 832 🏁 Script executed: Length of output: 255 🏁 Script executed: Length of output: 13117 🏁 Script executed: Length of output: 296 🏁 Script executed: Length of output: 94 🏁 Script executed: Length of output: 4824 🏁 Script executed: Length of output: 74 🏁 Script executed: Length of output: 347 🏁 Script executed: Length of output: 3440 🏁 Script executed: Length of output: 5250 @amotl I've reviewed the PR for active voice usage. You're absolutely right that most of the content is already well-written in active voice! The tutorial uses clear, direct instructions and imperative sentences effectively. However, I found a few opportunities to strengthen the active voice further: Specific suggestions for improved active voice:Line 6 - Current:
Suggested (more direct active voice):
Line 38 - Current:
Suggested:
Line 71 - Current:
Suggested:
Overall AssessmentThe tutorial is already written predominantly in active voice with clear, actionable instructions. The imperative mood used throughout ("check the deployment options", "create and populate the table", "install the required libraries") is excellent for tutorial content. The suggestions above would eliminate the remaining first-person references and make the language even more direct and active. The content follows best practices for technical documentation voice, so these are minor refinements rather than major issues. 🧠 Learnings used✅ Actions performedReview triggered.
|
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
1 similar comment
✅ Actions performedReview triggered.
|
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.
Actionable comments posted: 3
🧹 Nitpick comments (3)
docs/integrate/langchain/tutorial.md (3)
56-60: Switch to ChatOpenAI and make the CrateDB URI explicit.Use chat model and show a realistic CrateDB URI (local or Cloud).
-llm=OpenAI(temperature=0) #play around with this parameter -#change the URI below to match your CrateDB instance -db = SQLDatabase.from_uri("crate://") +llm = ChatOpenAI(model="gpt-4o-mini", temperature=0) +# Change the URI below to match your CrateDB instance +# e.g., local: "crate://localhost:4200" +# e.g., Cloud (with TLS): "crate://<user>:<password>@<cluster>.cratedb.net:4200?ssl=true" +db = SQLDatabase.from_uri("crate://localhost:4200")
- Chat models are the recommended default; OpenAI integration comes from
langchain-openai. (python.langchain.com)- CrateDB SQLAlchemy URIs and Cloud
?ssl=trueoption. (cratedb.com)
70-76: Tighten safety guidance (least-privilege DB user).Add a short note to use a least-privileged database user when connecting LLM agents to production data, and avoid sending sensitive data to third-party providers unless contractually approved.
-Keep in mind, that by connecting to CrateDB with the OpenAI API, you are giving it access to perform a variety of queries on your data, so avoid using it with your production environment or use a specific user with limited permissions. +Keep in mind that connecting an LLM agent to CrateDB enables it to run queries on your data. For production, use a least‑privileged database user and avoid sending sensitive data to external providers unless contractually approved.
80-81: Use the new anchor label for consistency.Since
(integrations)=now exists, point the ref to it.-... have a look at the {ref}`integrations section <integrate>` ... +... have a look at the {ref}`integrations section <integrations>` ...Ensure both labels are intended to coexist; current index defines both. (python.langchain.com)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
docs/integrate/index.md(1 hunks)docs/integrate/langchain/index.md(2 hunks)docs/integrate/langchain/tutorial.md(1 hunks)
🔇 Additional comments (3)
docs/integrate/langchain/index.md (2)
74-74: LGTM!The replacement of the external badge navigation with an internal Sphinx cross-reference
{ref}langchain-tutorial`` provides better integration with the documentation structure and maintains consistency with Sphinx conventions.
207-211: LGTM!The hidden toctree properly integrates the tutorial into the documentation structure while keeping the navigation clean. The
maxdepth: 1andhidden:directives are appropriate for this use case.docs/integrate/index.md (1)
2-2: Alias label looks good for backward-compatible refs.Adding
(integrations)=while keeping(integrate)=preserves existing cross-refs and enables the new label. No action needed.
docs/integrate/langchain/tutorial.md
Outdated
| pip install 'langchain[openai]' 'sqlalchemy-cratedb' | ||
| ``` |
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 install instructions to current LangChain packaging.
Use separate integration packages; langchain[openai] is outdated. Recommend:
-pip install 'langchain[openai]' 'sqlalchemy-cratedb'
+pip install -U langchain-community langchain-openai sqlalchemy-cratedb- OpenAI models now live in
langchain-openai. (python.langchain.com) - Community integrations (SQL, toolkits) live in
langchain-community. (python.langchain.com)
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| pip install 'langchain[openai]' 'sqlalchemy-cratedb' | |
| ``` | |
| pip install -U langchain-community langchain-openai sqlalchemy-cratedb |
🤖 Prompt for AI Agents
In docs/integrate/langchain/tutorial.md around lines 37-38, the pip install
guidance uses the outdated monolithic specifier `langchain[openai]`; update the
instructions to install the new integration packages instead — replace the
single install line with a command that installs `langchain-openai` and
`langchain-community` (and keep/mention any required DB libs like `sqlalchemy`
separately), and update or add the two links to the LangChain docs for OpenAI
and community integrations so readers use the current packaging.
About
Continue adding tutorials from the community forum.
Preview
References