Wendong-Fan commited on
Commit
e26ba2b
·
1 Parent(s): 5841fc9

update run_ollama

Browse files
Files changed (5) hide show
  1. README.md +1 -1
  2. README_zh.md +1 -1
  3. owl/.env_template +1 -4
  4. owl/app.py +0 -7
  5. owl/run_ollama.py +16 -20
README.md CHANGED
@@ -247,7 +247,7 @@ python owl/run_deepseek_zh.py
247
  # Run with other OpenAI-compatible models
248
  python owl/run_openai_compatiable_model.py
249
 
250
- # Run with Ollama API
251
  python owl/run_ollama.py
252
  ```
253
 
 
247
  # Run with other OpenAI-compatible models
248
  python owl/run_openai_compatiable_model.py
249
 
250
+ # Run with Ollama
251
  python owl/run_ollama.py
252
  ```
253
 
README_zh.md CHANGED
@@ -247,7 +247,7 @@ python owl/run_deepseek_zh.py
247
  # 使用其他 OpenAI 兼容模型运行
248
  python owl/run_openai_compatiable_model.py
249
 
250
- # 使用 Ollama API 运行
251
  python owl/run_ollama.py
252
  ```
253
 
 
247
  # 使用其他 OpenAI 兼容模型运行
248
  python owl/run_openai_compatiable_model.py
249
 
250
+ # 使用 Ollama 运行
251
  python owl/run_ollama.py
252
  ```
253
 
owl/.env_template CHANGED
@@ -1,7 +1,4 @@
1
- # MODEL & API (See https://github.com/camel-ai/camel/blob/master/camel/types/enums.py)
2
-
3
- # Ollama API
4
- OLLAMA_API_KEY=""
5
 
6
  # OPENAI API
7
  OPENAI_API_KEY= ""
 
1
+ # MODEL & API (See https://docs.camel-ai.org/key_modules/models.html#)
 
 
 
2
 
3
  # OPENAI API
4
  OPENAI_API_KEY= ""
owl/app.py CHANGED
@@ -86,13 +86,6 @@ ENV_GROUPS = {
86
  "required": False,
87
  "help": "DeepSeek API密钥,用于访问DeepSeek模型。获取方式:https://platform.deepseek.com/api_keys",
88
  },
89
- {
90
- "name": "OLLAMA_API_KEY",
91
- "label": "Ollama API秘钥",
92
- "type": "password",
93
- "required": False,
94
- "help": "Ollama API秘钥,没啥用的",
95
- },
96
  ],
97
  "搜索工具": [
98
  {
 
86
  "required": False,
87
  "help": "DeepSeek API密钥,用于访问DeepSeek模型。获取方式:https://platform.deepseek.com/api_keys",
88
  },
 
 
 
 
 
 
 
89
  ],
90
  "搜索工具": [
91
  {
owl/run_ollama.py CHANGED
@@ -12,7 +12,6 @@
12
  # limitations under the License.
13
  # ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
14
  # run_ollama.py by tj-scripts(https://github.com/tj-scripts)
15
- import os
16
 
17
  from dotenv import load_dotenv
18
  from camel.models import ModelFactory
@@ -22,6 +21,7 @@ from camel.toolkits import (
22
  ImageAnalysisToolkit,
23
  SearchToolkit,
24
  WebToolkit,
 
25
  )
26
  from camel.types import ModelPlatformType
27
 
@@ -47,39 +47,34 @@ def construct_society(question: str) -> OwlRolePlaying:
47
  # Create models for different components
48
  models = {
49
  "user": ModelFactory.create(
50
- model_platform=ModelPlatformType.OPENAI_COMPATIBLE_MODEL,
51
- model_type="qwen2.5:3b",
52
- api_key=os.getenv("OLLAMA_API_KEY"),
53
  url="http://localhost:11434/v1",
54
- model_config_dict={"temperature": 0.8, "max_tokens": 4096},
55
  ),
56
  "assistant": ModelFactory.create(
57
- model_platform=ModelPlatformType.OPENAI_COMPATIBLE_MODEL,
58
- model_type="qwen2.5:3b",
59
- api_key=os.getenv("OLLAMA_API_KEY"),
60
  url="http://localhost:11434/v1",
61
- model_config_dict={"temperature": 0.2, "max_tokens": 4096},
62
  ),
63
  "web": ModelFactory.create(
64
- model_platform=ModelPlatformType.OPENAI_COMPATIBLE_MODEL,
65
  model_type="llava:latest",
66
- api_key=os.getenv("QWEN_API_KEY"),
67
  url="http://localhost:11434/v1",
68
- model_config_dict={"temperature": 0.4, "max_tokens": 4096},
69
  ),
70
  "planning": ModelFactory.create(
71
- model_platform=ModelPlatformType.OPENAI_COMPATIBLE_MODEL,
72
- model_type="qwen2.5:3b",
73
- api_key=os.getenv("ollama"),
74
  url="http://localhost:11434/v1",
75
- model_config_dict={"temperature": 0.4, "max_tokens": 4096},
76
  ),
77
  "image": ModelFactory.create(
78
- model_platform=ModelPlatformType.OPENAI_COMPATIBLE_MODEL,
79
  model_type="llava:latest",
80
- api_key=os.getenv("QWEN_API_KEY"),
81
  url="http://localhost:11434/v1",
82
- model_config_dict={"temperature": 0.4, "max_tokens": 4096},
83
  ),
84
  }
85
 
@@ -93,9 +88,10 @@ def construct_society(question: str) -> OwlRolePlaying:
93
  *CodeExecutionToolkit(sandbox="subprocess", verbose=True).get_tools(),
94
  *ImageAnalysisToolkit(model=models["image"]).get_tools(),
95
  SearchToolkit().search_duckduckgo,
96
- #SearchToolkit().search_google, # Comment this out if you don't have google search
97
  SearchToolkit().search_wiki,
98
  *ExcelToolkit().get_tools(),
 
99
  ]
100
 
101
  # Configure agent roles and parameters
 
12
  # limitations under the License.
13
  # ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
14
  # run_ollama.py by tj-scripts(https://github.com/tj-scripts)
 
15
 
16
  from dotenv import load_dotenv
17
  from camel.models import ModelFactory
 
21
  ImageAnalysisToolkit,
22
  SearchToolkit,
23
  WebToolkit,
24
+ FileWriteToolkit,
25
  )
26
  from camel.types import ModelPlatformType
27
 
 
47
  # Create models for different components
48
  models = {
49
  "user": ModelFactory.create(
50
+ model_platform=ModelPlatformType.OLLAMA,
51
+ model_type="qwen2.5:72b",
 
52
  url="http://localhost:11434/v1",
53
+ model_config_dict={"temperature": 0.8, "max_tokens": 1000000},
54
  ),
55
  "assistant": ModelFactory.create(
56
+ model_platform=ModelPlatformType.OLLAMA,
57
+ model_type="qwen2.5:72b",
 
58
  url="http://localhost:11434/v1",
59
+ model_config_dict={"temperature": 0.2, "max_tokens": 1000000},
60
  ),
61
  "web": ModelFactory.create(
62
+ model_platform=ModelPlatformType.OLLAMA,
63
  model_type="llava:latest",
 
64
  url="http://localhost:11434/v1",
65
+ model_config_dict={"temperature": 0.4, "max_tokens": 1000000},
66
  ),
67
  "planning": ModelFactory.create(
68
+ model_platform=ModelPlatformType.OLLAMA,
69
+ model_type="qwen2.5:72b",
 
70
  url="http://localhost:11434/v1",
71
+ model_config_dict={"temperature": 0.4, "max_tokens": 1000000},
72
  ),
73
  "image": ModelFactory.create(
74
+ model_platform=ModelPlatformType.OLLAMA,
75
  model_type="llava:latest",
 
76
  url="http://localhost:11434/v1",
77
+ model_config_dict={"temperature": 0.4, "max_tokens": 1000000},
78
  ),
79
  }
80
 
 
88
  *CodeExecutionToolkit(sandbox="subprocess", verbose=True).get_tools(),
89
  *ImageAnalysisToolkit(model=models["image"]).get_tools(),
90
  SearchToolkit().search_duckduckgo,
91
+ # SearchToolkit().search_google, # Comment this out if you don't have google search
92
  SearchToolkit().search_wiki,
93
  *ExcelToolkit().get_tools(),
94
+ *FileWriteToolkit(output_dir="./").get_tools(),
95
  ]
96
 
97
  # Configure agent roles and parameters