文章预览
今天,我们做了两个实验,目标在15分钟内,完成下载社区的开源模型,部署成API,替换LlamaIndex中RAG和LangChain中OpenAI接口Agent的最佳实践,并取得符合预期的结果。 01 实验一 实验目标:Qwen2+Ollama+LlamaIndex实现RAG应用 实验时长:15分钟 运行设备:Mac,CPU,GPU均可 环境安装: pip install llama- index llama_index.llms.ollama llama- index -embeddings-huggingface modelscope 运行Qwen2模型 复制模型路径,创建名为“ModelFile”的meta文件,内容如下: FROM /mnt/workspace/qwen2 -7 b-instruct-q5_k_m.gguf # set the temperature to 0.7 [higher is more creative, lower is more coherent] PARAMETER temperature 0.7 PARAMETER top_p 0.8 PARAMETER repeat_penalty 1.05 TEMPLATE """{{ if and .First .System }}system {{ .System }} {{ end }}user {{ .Prompt }} assistant {{ .Response }}""" # set the system message SYSTEM """ You are a helpful assistant. """ 使用ollama create命令创建自定
………………………………