mirror of
https://github.com/camel-ai/owl.git
synced 2025-12-26 10:07:51 +08:00
update run_ollama
This commit is contained in:
parent
950d1eec0c
commit
e1c661b5f8
@ -247,7 +247,7 @@ python owl/run_deepseek_zh.py
|
||||
# Run with other OpenAI-compatible models
|
||||
python owl/run_openai_compatiable_model.py
|
||||
|
||||
# Run with Ollama API
|
||||
# Run with Ollama
|
||||
python owl/run_ollama.py
|
||||
```
|
||||
|
||||
|
||||
@ -247,7 +247,7 @@ python owl/run_deepseek_zh.py
|
||||
# 使用其他 OpenAI 兼容模型运行
|
||||
python owl/run_openai_compatiable_model.py
|
||||
|
||||
# 使用 Ollama API 运行
|
||||
# 使用 Ollama 运行
|
||||
python owl/run_ollama.py
|
||||
```
|
||||
|
||||
|
||||
@ -1,7 +1,4 @@
|
||||
# MODEL & API (See https://github.com/camel-ai/camel/blob/master/camel/types/enums.py)
|
||||
|
||||
# Ollama API
|
||||
OLLAMA_API_KEY=""
|
||||
# MODEL & API (See https://docs.camel-ai.org/key_modules/models.html#)
|
||||
|
||||
# OPENAI API
|
||||
OPENAI_API_KEY= ""
|
||||
|
||||
@ -86,13 +86,6 @@ ENV_GROUPS = {
|
||||
"required": False,
|
||||
"help": "DeepSeek API密钥,用于访问DeepSeek模型。获取方式:https://platform.deepseek.com/api_keys",
|
||||
},
|
||||
{
|
||||
"name": "OLLAMA_API_KEY",
|
||||
"label": "Ollama API秘钥",
|
||||
"type": "password",
|
||||
"required": False,
|
||||
"help": "Ollama API秘钥,没啥用的",
|
||||
},
|
||||
],
|
||||
"搜索工具": [
|
||||
{
|
||||
|
||||
@ -12,7 +12,6 @@
|
||||
# limitations under the License.
|
||||
# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
|
||||
# run_ollama.py by tj-scripts(https://github.com/tj-scripts)
|
||||
import os
|
||||
|
||||
from dotenv import load_dotenv
|
||||
from camel.models import ModelFactory
|
||||
@ -22,6 +21,7 @@ from camel.toolkits import (
|
||||
ImageAnalysisToolkit,
|
||||
SearchToolkit,
|
||||
WebToolkit,
|
||||
FileWriteToolkit,
|
||||
)
|
||||
from camel.types import ModelPlatformType
|
||||
|
||||
@ -47,39 +47,34 @@ def construct_society(question: str) -> OwlRolePlaying:
|
||||
# Create models for different components
|
||||
models = {
|
||||
"user": ModelFactory.create(
|
||||
model_platform=ModelPlatformType.OPENAI_COMPATIBLE_MODEL,
|
||||
model_type="qwen2.5:3b",
|
||||
api_key=os.getenv("OLLAMA_API_KEY"),
|
||||
model_platform=ModelPlatformType.OLLAMA,
|
||||
model_type="qwen2.5:72b",
|
||||
url="http://localhost:11434/v1",
|
||||
model_config_dict={"temperature": 0.8, "max_tokens": 4096},
|
||||
model_config_dict={"temperature": 0.8, "max_tokens": 1000000},
|
||||
),
|
||||
"assistant": ModelFactory.create(
|
||||
model_platform=ModelPlatformType.OPENAI_COMPATIBLE_MODEL,
|
||||
model_type="qwen2.5:3b",
|
||||
api_key=os.getenv("OLLAMA_API_KEY"),
|
||||
model_platform=ModelPlatformType.OLLAMA,
|
||||
model_type="qwen2.5:72b",
|
||||
url="http://localhost:11434/v1",
|
||||
model_config_dict={"temperature": 0.2, "max_tokens": 4096},
|
||||
model_config_dict={"temperature": 0.2, "max_tokens": 1000000},
|
||||
),
|
||||
"web": ModelFactory.create(
|
||||
model_platform=ModelPlatformType.OPENAI_COMPATIBLE_MODEL,
|
||||
model_platform=ModelPlatformType.OLLAMA,
|
||||
model_type="llava:latest",
|
||||
api_key=os.getenv("QWEN_API_KEY"),
|
||||
url="http://localhost:11434/v1",
|
||||
model_config_dict={"temperature": 0.4, "max_tokens": 4096},
|
||||
model_config_dict={"temperature": 0.4, "max_tokens": 1000000},
|
||||
),
|
||||
"planning": ModelFactory.create(
|
||||
model_platform=ModelPlatformType.OPENAI_COMPATIBLE_MODEL,
|
||||
model_type="qwen2.5:3b",
|
||||
api_key=os.getenv("ollama"),
|
||||
model_platform=ModelPlatformType.OLLAMA,
|
||||
model_type="qwen2.5:72b",
|
||||
url="http://localhost:11434/v1",
|
||||
model_config_dict={"temperature": 0.4, "max_tokens": 4096},
|
||||
model_config_dict={"temperature": 0.4, "max_tokens": 1000000},
|
||||
),
|
||||
"image": ModelFactory.create(
|
||||
model_platform=ModelPlatformType.OPENAI_COMPATIBLE_MODEL,
|
||||
model_platform=ModelPlatformType.OLLAMA,
|
||||
model_type="llava:latest",
|
||||
api_key=os.getenv("QWEN_API_KEY"),
|
||||
url="http://localhost:11434/v1",
|
||||
model_config_dict={"temperature": 0.4, "max_tokens": 4096},
|
||||
model_config_dict={"temperature": 0.4, "max_tokens": 1000000},
|
||||
),
|
||||
}
|
||||
|
||||
@ -93,9 +88,10 @@ def construct_society(question: str) -> OwlRolePlaying:
|
||||
*CodeExecutionToolkit(sandbox="subprocess", verbose=True).get_tools(),
|
||||
*ImageAnalysisToolkit(model=models["image"]).get_tools(),
|
||||
SearchToolkit().search_duckduckgo,
|
||||
#SearchToolkit().search_google, # Comment this out if you don't have google search
|
||||
# SearchToolkit().search_google, # Comment this out if you don't have google search
|
||||
SearchToolkit().search_wiki,
|
||||
*ExcelToolkit().get_tools(),
|
||||
*FileWriteToolkit(output_dir="./").get_tools(),
|
||||
]
|
||||
|
||||
# Configure agent roles and parameters
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user