Skip to content
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

feat(model): support ollama as an optional llm & embedding proxy #1475

Merged
merged 2 commits into from
Apr 28, 2024

Conversation

GITHUBear
Copy link
Contributor

Description

Support Ollama as an optional LLM and Embedding proxy via lib ollama-python

Use Ollama Proxy LLM by modifying the following .env configurations:

LLM_MODEL=ollama_proxyllm
MODEL_SERVER=http://127.0.0.1:11434
PROXYLLM_BACKEND=llama3:instruct

Use Ollama Proxy Embedding by modifying the following .env configurations:

EMBEDDING_MODEL=proxy_ollama
proxy_ollama_proxy_server_url=http://127.0.0.1:11434
proxy_ollama_proxy_backend=llama3:instruct

How Has This Been Tested?

  • Simple Chat.
  • Chat Data.
  • Knowledge Base.

Snapshots:

Checklist:

  • My code follows the style guidelines of this project
  • I have already rebased the commits and make the commit message conform to the project standard.
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • Any dependent changes have been merged and published in downstream modules

Signed-off-by: shanhaikang.shk <shanhaikang.shk@oceanbase.com>
@Aries-ckt
Copy link
Collaborator

hi, @GITHUBear, thanks for your contribution, ollama is a good llm management tool. @fangyinc have a check please.

@Aries-ckt Aries-ckt requested a review from fangyinc April 28, 2024 06:01
@fangyinc fangyinc changed the title support ollama as an optional llm & embedding proxy feat(model): support ollama as an optional llm & embedding proxy Apr 28, 2024
@github-actions github-actions bot added enhancement New feature or request model Module: model labels Apr 28, 2024
@fangyinc
Copy link
Collaborator

fangyinc commented Apr 28, 2024

Test passed.

Install ollama

If your system is linux.

curl -fsSL https://ollama.com/install.sh | sh

Pull models.

  1. Pull LLM
ollama pull qwen:0.5b
  1. Pull embedding model.
ollama pull nomic-embed-text
  1. install ollama package.
pip install ollama

Use ollama proxy model in DB-GPT

LLM_MODEL=ollama_proxyllm \
PROXY_SERVER_URL=http://127.0.0.1:11434 \
PROXYLLM_BACKEND="qwen:0.5b" \
PROXY_API_KEY=not_used \
EMBEDDING_MODEL=proxy_ollama \
proxy_ollama_proxy_server_url=http://127.0.0.1:11434 \
proxy_ollama_proxy_backend="nomic-embed-text:latest"   \
dbgpt start webserver

fangyinc
fangyinc previously approved these changes Apr 28, 2024
Copy link
Collaborator

@fangyinc fangyinc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@fangyinc
Copy link
Collaborator

Use ollama with python code.

import asyncio
from dbgpt.core import ModelRequest
from dbgpt.model.proxy import OllamaLLMClient

client=OllamaLLMClient()

print(asyncio.run(client.generate(ModelRequest._build("qwen:0.5b", "你是谁?"))))

Copy link
Collaborator

@fangyinc fangyinc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r+

Copy link
Collaborator

@Aries-ckt Aries-ckt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@Aries-ckt Aries-ckt merged commit 744b3e4 into eosphoros-ai:main Apr 28, 2024
4 checks passed
Hopshine pushed a commit to Hopshine/DB-GPT that referenced this pull request Sep 10, 2024
…phoros-ai#1475)

Signed-off-by: shanhaikang.shk <shanhaikang.shk@oceanbase.com>
Co-authored-by: Fangyin Cheng <staneyffer@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request model Module: model
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants