Comments (4)
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.
现在frontier(开发)分支有直接支持ollama的接入了,这样就可以同时接入OpenAI和ollama了
from gpt_academic.
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.
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)
- [Bug]: api_key 验证无效 HOT 7
- [Bug]: 连接超时 HOT 1
- [Bug]: Latex全文校对纠错的结果没有高亮显示
- [Feature]: 批量arxiv论文翻译。 HOT 3
- [Bug]:本地latex翻译在pdf切分卡住 无响应,Arxiv下载插件报错 HOT 2
- [Feature]: [Local Message] 异常 HOT 3
- [Bug]: OpenAI以账户额度不足为由拒绝服务 HOT 1
- [Feature]: 能否直接通过localhost链接提问?
- [Feature]: 支持RAG
- [Bug]: 3.12的Python部分依赖不支持,请问该如何解决 HOT 2
- [Bug]: arxiv论文翻译编译成功率底
- [Bug]: arkiv论文编译完成后会停住,手动点击停止后才会把后面的成功或失败信息打印出来 HOT 1
- [Bug]: openai的apikey改格式了,原有的apikey匹配方法匹配不上 HOT 2
- [Feature]: 希望可以为对话渲染markdown标题
- [Feature]: 希望可以支持O1!
- [Feature]: 希望学术检索助手增加对pubmed的支持
- [Feature]: 分享一个使用在海外服务器用ngnix反向代理https访问的方法
- [Bug]: 谷歌学术检索助手插件一直在初始化 HOT 3
- [Bug]: 插件查互联网后回答无法使用 HOT 4
- [Bug]: o1-preview响应过久
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gpt_academic.