Giter Club home page Giter Club logo

Comments (4)

zerotoone01 avatar zerotoone01 commented on September 20, 2024 2

ollama serve 命令执行前,先执行下面环境变量,否则其他服务无法访问:
export OLLAMA_HOST="0.0.0.0:11434"

v37.4版本是可以直接支持的,改config.py的几个点即可(遵循one-api接口规范):
config.py

API_KEY = "ollama-key"
LLM_MODEL = "one-api-qwen:14b(max_token=32768)"

API_URL_REDIRECT = {"https://api.openai.com/v1/chat/completions": "http://your_ip:11434/v1/chat/completions"}

AVAIL_LLM_MODELS = ["one-api-qwen:14b(max_token=32768)"]

CUSTOM_API_KEY_PATTERN = "ollama-key"

from gpt_academic.

Menghuan1918 avatar Menghuan1918 commented on September 20, 2024

#1740

现在frontier(开发)分支有直接支持ollama的接入了,这样就可以同时接入OpenAI和ollama了

from gpt_academic.

SoDebug avatar SoDebug commented on September 20, 2024

ollama serve 命令执行前,先执行下面环境变量,否则其他服务无法访问: export OLLAMA_HOST="0.0.0.0:11434"

v37.4版本是可以直接支持的,改config.py的几个点即可(遵循one-api接口规范): config.py

API_KEY = "ollama-key" LLM_MODEL = "one-api-qwen:14b(max_token=32768)"

API_URL_REDIRECT = {"https://api.openai.com/v1/chat/completions": "http://your_ip:11434/v1/chat/completions"}

AVAIL_LLM_MODELS = ["one-api-qwen:14b(max_token=32768)"]

CUSTOM_API_KEY_PATTERN = "ollama-key"

ollama-key?好像没在ollama文档里面看见这个东西 能详细说说吗

from gpt_academic.

lin-uice avatar lin-uice commented on September 20, 2024

llama3 配置:
LLM_MODEL = "ollama-llama3(max_token=4096)"
AVAIL_LLM_MODELS = ["one-api-claude-3-sonnet-20240229(max_token=100000)", "ollama-llama3(max_token=4096)"] #如果你的模型是llama2,就填llama2,注意:一定不要填错
API_URL_REDIRECT = {"http://localhost:11434/api/chat": "http://:11434/api/chat"}# your address

下面是原因,感兴趣可以看
#模型调用的本质.即:request库必须匹配到对应的模型名才可以已正常访问,ollama是一个管理库,而不是名称.
import requests
url = 'http://*******:11434/api/chat'
data = {
"model": "llama3", "messages": [
{ "role": "user", "content": "why is the sky blue?" }
]
}
response = requests.post(url, json=data)

打印响应内容
print(response.text)

from gpt_academic.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.