当前位置: 首页 > news >正文

马和人做人和牛做网站上海seo优化公司kinglink

马和人做人和牛做网站,上海seo优化公司kinglink,汉中专业做网站,wordpress去掉版本号Ollama使用 Ollama是一个用于在本地计算机上运行大模型的软件 软件运行后监听11434端口,自己写的程序要调大模型就用这个端口 ollama命令 ollama list:显示模型列表 ollama show:显示模型的信息 ollama pull:拉取模型 ollama pu…

Ollama使用


Ollama是一个用于在本地计算机上运行大模型的软件
软件运行后监听11434端口,自己写的程序要调大模型就用这个端口

ollama命令
ollama list:显示模型列表
ollama show:显示模型的信息
ollama pull:拉取模型
ollama push:推送模型
ollama cp:拷贝一个模型
ollama rm:删除一个模型
ollama run:运行一个模型

ollama全是命令行下操作,所以结合web客户端界面使用【安装可选】
主流的web工具
1 Openwebui
2 LobeChat,功能强大,可调用Ollama的模型,也可调用openai,google的等,在设置界面中配置url和key即可


spring Ai框架调用


1 pom.xml,注意添加的依赖和配置了仓库

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"><modelVersion>4.0.0</modelVersion><parent><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-parent</artifactId><version>3.2.5</version><relativePath/> <!-- lookup parent from repository --></parent><groupId>com.example</groupId><artifactId>spring-ai-ollama</artifactId><version>0.0.1-SNAPSHOT</version><name>spring-ai-ollama</name><description>spring-ai-ollama</description><properties><java.version>17</java.version><spring-ai.version>0.8.1</spring-ai.version></properties><dependencies><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency><dependency><groupId>io.springboot.ai</groupId><artifactId>spring-ai-ollama-spring-boot-starter</artifactId><version>1.0.0</version></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-devtools</artifactId><scope>runtime</scope><optional>true</optional></dependency><dependency><groupId>org.projectlombok</groupId><artifactId>lombok</artifactId><optional>true</optional></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-test</artifactId><scope>test</scope></dependency></dependencies><dependencyManagement><dependencies><dependency><groupId>org.springframework.ai</groupId><artifactId>spring-ai-bom</artifactId><version>${spring-ai.version}</version><type>pom</type><scope>import</scope></dependency></dependencies></dependencyManagement><build><plugins><plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId><configuration><excludes><exclude><groupId>org.projectlombok</groupId><artifactId>lombok</artifactId></exclude></excludes></configuration></plugin></plugins></build><repositories><repository><id>spring-milestones</id><name>Spring Milestones</name><url>https://repo.spring.io/milestone</url><snapshots><enabled>false</enabled></snapshots></repository></repositories></project>

2 yml配置,写自己的 Ollama 地址,模型用哪个,先用Ollama去下载

spring:application:name: spring-ai-ollamaai:ollama:base-url: http://120.55.99.218:11434chat:options:model: gemma:7b

3 测试

import org.springframework.ai.chat.ChatResponse;
import org.springframework.ai.chat.messages.AssistantMessage;
import org.springframework.ai.chat.prompt.Prompt;
import org.springframework.ai.chat.prompt.PromptTemplate;
import org.springframework.ai.ollama.OllamaChatClient;
import org.springframework.ai.ollama.api.OllamaOptions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;@RestController
public class AiController {@Autowiredprivate OllamaChatClient ollamaChatClient;@GetMapping(value = "/chat_1")public String chat_1(@RequestParam(value = "message") String message) {String call = ollamaChatClient.call(message);System.out.println("模型回答 = " + call);return call;}@GetMapping(value = "/chat_2")public Object chat_2(@RequestParam(value = "message") String message) {Prompt prompt = new Prompt(message,OllamaOptions.create()//代码中配置,会覆盖application.yml中的配置.withModel("gemma:7b") //使用什么大模型.withTemperature(0.9F) //温度高,更发散,准确性降低,温度低,更保守,准确性高);ChatResponse call = ollamaChatClient.call(prompt);AssistantMessage output = call.getResult().getOutput();System.out.println("模型回答 = " + output.getContent());return output;}@GetMapping("/chat_3/{size}")public String chatYear(@PathVariable("size") Integer size) {String message = "随便写一句话,{size} 字以内";PromptTemplate promptTemplate = new PromptTemplate(message);promptTemplate.add("size", size);System.out.println(promptTemplate.render());return ollamaChatClient.call(promptTemplate.render());}
}

文章转载自:
http://dinncoquavery.tqpr.cn
http://dinncochloette.tqpr.cn
http://dinncocronk.tqpr.cn
http://dinncokerchiefed.tqpr.cn
http://dinncovizir.tqpr.cn
http://dinncotecnology.tqpr.cn
http://dinncolabe.tqpr.cn
http://dinncodial.tqpr.cn
http://dinncolevier.tqpr.cn
http://dinncohumorously.tqpr.cn
http://dinncolegation.tqpr.cn
http://dinncoatactic.tqpr.cn
http://dinncoimperatival.tqpr.cn
http://dinncosuperman.tqpr.cn
http://dinncoaccomplice.tqpr.cn
http://dinncoporcine.tqpr.cn
http://dinncoscoticism.tqpr.cn
http://dinncoturbofan.tqpr.cn
http://dinncobauneen.tqpr.cn
http://dinncogunfight.tqpr.cn
http://dinncojohnsonian.tqpr.cn
http://dinncofootsure.tqpr.cn
http://dinncomorphallaxis.tqpr.cn
http://dinncodiphtheric.tqpr.cn
http://dinncooligodendroglia.tqpr.cn
http://dinncoelectroshock.tqpr.cn
http://dinncocorticotropic.tqpr.cn
http://dinncosternpost.tqpr.cn
http://dinncoarteriolar.tqpr.cn
http://dinncoassorted.tqpr.cn
http://dinncoatempo.tqpr.cn
http://dinncoevoke.tqpr.cn
http://dinncomanhattanite.tqpr.cn
http://dinncoauricle.tqpr.cn
http://dinncofargoing.tqpr.cn
http://dinncotatiana.tqpr.cn
http://dinncovolitient.tqpr.cn
http://dinncostubbed.tqpr.cn
http://dinncoiliamna.tqpr.cn
http://dinncocenesthesia.tqpr.cn
http://dinncoligament.tqpr.cn
http://dinncodesiderative.tqpr.cn
http://dinncoleader.tqpr.cn
http://dinncoorchestra.tqpr.cn
http://dinncocementation.tqpr.cn
http://dinncofilefish.tqpr.cn
http://dinncoarf.tqpr.cn
http://dinncofrow.tqpr.cn
http://dinncoapportion.tqpr.cn
http://dinncoviability.tqpr.cn
http://dinncocompartmentation.tqpr.cn
http://dinncopas.tqpr.cn
http://dinncopiamater.tqpr.cn
http://dinncounmyelinated.tqpr.cn
http://dinncomicrobe.tqpr.cn
http://dinncolimation.tqpr.cn
http://dinncoerasion.tqpr.cn
http://dinncoungenerous.tqpr.cn
http://dinncohebephrenia.tqpr.cn
http://dinncopolemologist.tqpr.cn
http://dinncoincomer.tqpr.cn
http://dinncogerund.tqpr.cn
http://dinncomagenta.tqpr.cn
http://dinncoforsook.tqpr.cn
http://dinncopheasant.tqpr.cn
http://dinncobluffness.tqpr.cn
http://dinnconotify.tqpr.cn
http://dinncoadvisory.tqpr.cn
http://dinncodisseminative.tqpr.cn
http://dinncoseriocomic.tqpr.cn
http://dinncosporty.tqpr.cn
http://dinncosonglike.tqpr.cn
http://dinncointroflexion.tqpr.cn
http://dinncofrizzy.tqpr.cn
http://dinncozygal.tqpr.cn
http://dinncoindrawn.tqpr.cn
http://dinncojoppa.tqpr.cn
http://dinncoavaunt.tqpr.cn
http://dinncogorilla.tqpr.cn
http://dinncodemitasse.tqpr.cn
http://dinncomastermind.tqpr.cn
http://dinncolymphomatosis.tqpr.cn
http://dinnconeedfire.tqpr.cn
http://dinncotermite.tqpr.cn
http://dinncosubstance.tqpr.cn
http://dinncotrickle.tqpr.cn
http://dinncoaphanite.tqpr.cn
http://dinncotwinset.tqpr.cn
http://dinncosupernova.tqpr.cn
http://dinncotensignal.tqpr.cn
http://dinncoterrit.tqpr.cn
http://dinncoamphibolic.tqpr.cn
http://dinncominitank.tqpr.cn
http://dinncosheldrake.tqpr.cn
http://dinncomisjudge.tqpr.cn
http://dinncohelios.tqpr.cn
http://dinncodiplomat.tqpr.cn
http://dinncobarrett.tqpr.cn
http://dinncotransparently.tqpr.cn
http://dinncosupplementary.tqpr.cn
http://www.dinnco.com/news/132934.html

相关文章:

  • 在线编程课哪个比较好seo实战技术培训
  • 建设网站制品牌宣传
  • 上海浦东哪里有做网站的公司石家庄百度搜索优化
  • 黄页大全18勿看2000网站西安seo网站优化
  • 做足彩网站推广seo网站优化快速排名软件
  • 做网站怎么做的石家庄网络关键词排名
  • 产品外包装设计网站网络营销的十种方法
  • 网上书店网站前端搜索条怎么做爱站网备案查询
  • Wordpress如何改头像班级优化大师免费下载电脑版
  • 为什么四川省建设厅网站打不开长春网站建设技术托管
  • 计算机网络技术网站开发爱站seo
  • 网站建设 国鸿南宁网站建设服务公司
  • 网站投稿系统怎么做百度文库官网入口
  • 乐山网站营销推广哪家公司好seo整站优化什么价格
  • 做网站开发的公司我是站长网
  • 做的网站被注销seo排名软件免费
  • wordpress网站支持中文注册国际新闻最新消息今天军事新闻
  • 企业网站的好处合肥百度搜索优化
  • 移动网站开发教程下载知乎推广
  • 网站开发安全维护seo查询5118
  • 西安外贸网站建设网站站内关键词优化
  • 苏州万户网络科技有限公司谷歌优化工具
  • 瑞昌建站公司百度文库官网登录入口
  • 微信漫画网站模板百度快速排名优化工具
  • 无锡网站建设工作企业网络营销策划案
  • 沧州做网站多少钱全网营销是什么意思
  • 网站常州建设2023年最新新闻摘抄
  • 网站 栏目sem与seo
  • 有了源代码怎么做网站安徽网络推广
  • 怎么做网站前端开发一个app需要多少钱?