langchain下载以及相关的一些包的下载

首先下载一个3.12的python环境。

然后开始配置环境

下载langchain本身

pip install langchain -i https://mirrors.aliyun.com/pypi/simple/

下载openai的专用组件

pip install langchain-openai openai -i https://mirrors.aliyun.com/pypi/simple/

下载其他的一些东西

pip install python-dotenv langchain-core -i https://mirrors.aliyun.com/pypi/simple/

后面一些东西

pip install langchain_community -i https://mirrors.aliyun.com/pypi/simple/

后面可以上官网去选择我们需要下载的专有模型的专有的package:

https://docs.langchain.com/oss/python/langchain/models#parameters

下面这个是初始化的本地ollama模型的代码

python 复制代码
from langchain_ollama import ChatOllama

# 设置本地模型,不使用深度思考
model = ChatOllama(base_url="http://localhost:11434", model="modelscope.cn/qwen/Qwen3-0.6B-GGUF:latest", reasoning=False)
# 打印结果,
print(model.invoke("什么是LangChain,1000字回答我"))
相关推荐
for_ever_love__12 小时前
LangChain Agentic RAG:让 Agent 自己决定要不要检索、检索几次
人工智能·golang·langchain·rag·langgraph·agentic·自适应检索
范中勤12 小时前
技术文档:模型工厂 `llm_provider` / `llm_use` 分层设计
设计模式·langchain·架构设计·模型工厂·llm_provider
for_ever_love__13 小时前
LangChain MultiVectorRetriever:一个文档存多个向量
人工智能·python·自然语言处理·langchain·ai大模型·多向量·摘要检索
for_ever_love__13 小时前
LangChain SelfQueryRetriever:让模型自己写过滤条件
人工智能·语言模型·langchain·nlp·全文检索·元数据查询·自查询检索
for_ever_love__14 小时前
LangChain 时间加权检索:让‘最近的事‘更容易被想起
人工智能·语言模型·数据挖掘·langchain·向量·检索·时间加权
范中勤15 小时前
适配器模式(Adapter Pattern):原理、场景与 LLM 多厂商工程落地
设计模式·架构·langchain·适配器模式·多厂商
for_ever_love__15 小时前
LangChain Text-to-SQL:让不会写 SQL 的人查数据库
数据库·sql·langchain·大模型·agent·rag·问答
逆风飞翔的小叔16 小时前
【AI智能体】Langchain 工具调用实战操作详解
langchain·langchain 工具调用·langchain 工具使用·langchain 工具详解·langchain 工具总结·langchain 工具·langchain tool
染指11101 天前
141.Agent-多Agent框架-编写并使用Skills
人工智能·语言模型·langchain·skill·agents
小盆女神节奶粉1 天前
LangChain 中间件
langchain·agent