首页 > 其他分享 >ollama + ollama web + fastapi app (langchain) demo

ollama + ollama web + fastapi app (langchain) demo

时间:2024-05-04 23:33:25浏览次数:31  
标签:web Ollama com langchain LangChain https demo ollama

ollama + ollama web + fastapi app (langchain) demo

https://github.com/fanqingsong/ollama-docker

Welcome to the Ollama Docker Compose Setup! This project simplifies the deployment of Ollama using Docker Compose, making it easy to run Ollama with all its dependencies in a containerized environment.

 

ollama

https://python.langchain.com/docs/integrations/llms/ollama/

Ollama

Ollama allows you to run open-source large language models, such as Llama 2, locally.

Ollama bundles model weights, configuration, and data into a single package, defined by a Modelfile.

It optimizes setup and configuration details, including GPU usage.

For a complete list of supported models and model variants, see the Ollama model library.

 

同义模型

https://ollama.com/library/qwen

 

meta模型

https://ollama.com/library/llama2

 

ollama镜像预置模型:

https://github.com/FultonBrowne/ollama-docker

 

ollama + ollamaweb 容器化部署方案

https://github.com/lgdd/chatollama

 

LangChain

https://python.langchain.com/docs/get_started/introduction

 

LangChain is a framework for developing applications powered by large language models (LLMs).

LangChain simplifies every stage of the LLM application lifecycle:

Diagram outlining the hierarchical organization of the LangChain framework, displaying the interconnected parts across multiple layers.

Concretely, the framework consists of the following open-source libraries:

  • langchain-core: Base abstractions and LangChain Expression Language.
  • langchain-community: Third party integrations.
    • Partner packages (e.g. langchain-openai, langchain-anthropic, etc.): Some integrations have been further split into their own lightweight packages that only depend on langchain-core.
  • langchain: Chains, agents, and retrieval strategies that make up an application's cognitive architecture.
  • langgraph: Build robust and stateful multi-actor applications with LLMs by modeling steps as edges and nodes in a graph.
  • langserve: Deploy LangChain chains as REST APIs.

The broader ecosystem includes:

  • LangSmith: A developer platform that lets you debug, test, evaluate, and monitor LLM applications and seamlessly integrates with LangChain.

 

API

https://api.python.langchain.com/en/latest/langchain_api_reference.html#

 

integration of ollama and langchain

https://python.langchain.com/docs/integrations/llms/ollama/#via-langchain
from langchain_community.llms import Ollama

llm = Ollama(model="llama3")

llm.invoke("Tell me a joke")

 

 

RAG

https://zhuanlan.zhihu.com/p/695140853

 

https://github.com/fanqingsong/ollama-docker/blob/main/src/rag.py

 

https://github.com/fanqingsong/DocQA/blob/main/app.py

 

标签:web,Ollama,com,langchain,LangChain,https,demo,ollama
From: https://www.cnblogs.com/lightsong/p/18172964

相关文章

  • Go-Web-开发学习手册(全)
    GoWeb开发学习手册(全)原文:zh.annas-archive.org/md5/2756E08144D91329B3B7569E0C2831DA译者:飞龙协议:CCBY-NC-SA4.0前言感谢您购买本书。我们希望通过本书中的示例和项目,您能从GoWeb开发新手变成一个能够承担面向生产的严肃项目的人。因此,本书在相对较高的水平上涉及......
  • Web Application扫描工具-IBM AppScan
    AppScan简介原名watchireAppscan,2007年被IBM收购,成为IBMAppscan。IBMAppScan是一款非常好用且功能强大的Web应用安全测试工具,曾以WatchfireAppScan的名称享誉业界,RationalAppScan可自动化Web应用的安全漏洞评估工作,能扫描和检测所有常见的Web应用安全漏洞,例如SQL注入(SQL-inj......
  • web日志取证分析工具
    工具简介此工具可从单一可疑线索作为调查起点,遍历所有可疑URL(CGI)和来源IP。下载地址https://security.tencent.com/index.php/opensource/detail/15使用方法PerlLogForensics.pl-filelogfile-websvr(nginx|httpd)[-ipip(ip,ip,ip)|-urlurl(url,url,url)]File:日志......
  • Web漏洞扫描器-Xray
    下载地址:https://github.com/chaitin/xray/releases使用环境:Windows、Linux、macOS皆可工具说明:Xray扫描器是一款功能强大的安全评估工具。支持主动、被动多种扫描方式,支持常见Web漏洞的自动化检测,可以灵活定义POC,功能丰富,调用简单,支持多种操作系统。官方使用文档:https://docs......
  • 华为USG6000防火墙WEB基本配置
    第一步:浏览器登录https://192.168.0.1 (缺省状态下WEB登录地址)进入防火墙WEB配置界面。 第二步:输入用户名和密码登录,用户名:admin密码:Admin@123(缺省状态下)。 第三步:进入快速向导,根据指引进行配置,然后点击【下一步】。 第四步:配置基本信息。(建......
  • Python-Web-渗透测试秘籍(全)
    PythonWeb渗透测试秘籍(全)原文:annas-archive.org/md5/9ECC87991CE5C1AD546C7BAEC6960102译者:飞龙协议:CCBY-NC-SA4.0前言欢迎阅读我们的Python和Web应用测试书。渗透测试是一个庞大的领域,而Python的领域更加广阔。我们希望我们的小书可以帮助您更好地管理这些庞大......
  • 【攻防靶场系列】WEB LLM 学习及实操(一)
    什么是LLM❓大型语言模型(LLM)是一种AI算法,可以处理用户输入并通过预测单词序列来创建合理的响应。他们在巨大的半公开数据集上接受训练,使用机器学习来分析语言的组成部分如何组合在一起。如何检测LLM漏洞❓确定LLM(语言模型)的输入,包括直接输入(如提示)和间接输入(如训练数......
  • webapi添加添加websocket中间件
    添加位置我按照MSDN的例子添加了一个复述客户端响应的中间件。需要注意的时,中间件采用那种方式添加,添加在哪。哪种方式我选择创建一条管道分支,只要时ws的连接请求,就转到这个分支因此,我们需要使用的是MapWhen()来创建管道分支。添加在哪要注意授权的问题,所以应该添加到授权......
  • webapi中间件没有使用终结点中间件时的注意事项
    最小webapi默认的中间件配置是这样的app.UseHttpsRedirection();app.UseAuthorization();app.MapControllers();app.Run();最小webapi没有使用app.UseRouting()和app.UseEndpoints。这种情况下我们添加的所有中间件其实都是位于终结点路由中间件EndpointRoutingMiddleware......
  • 5.3 居家养老web端控制台
    基于vue3+ElementPlus做的一个居家养老静态界面,内容准备后期实现以下是效果图特别声明用到了百度地图JSAPI进行位置展示与iVCam模拟实时监控 以下是代码部分<scriptsetup>import{onMounted,onBeforeUnmount}from'vue'import{ref}from'vue'constvideoRef......