thekage91
commited on
Commit
·
20253a0
1
Parent(s):
d380057
Update model settings to use more capable models from Groq
Browse files- owl/run_groq.py +25 -7
owl/run_groq.py
CHANGED
@@ -11,6 +11,21 @@
|
|
11 |
# See the License for the specific language governing permissions and
|
12 |
# limitations under the License.
|
13 |
# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
from dotenv import load_dotenv
|
15 |
from camel.models import ModelFactory
|
16 |
from camel.toolkits import (
|
@@ -47,37 +62,37 @@ def construct_society(question: str) -> OwlRolePlaying:
|
|
47 |
models = {
|
48 |
"user": ModelFactory.create(
|
49 |
model_platform=ModelPlatformType.GROQ,
|
50 |
-
model_type=ModelType.GROQ_LLAMA_3_1_8B,
|
51 |
model_config_dict={"temperature": 0},
|
52 |
),
|
53 |
"assistant": ModelFactory.create(
|
54 |
model_platform=ModelPlatformType.GROQ,
|
55 |
-
model_type=ModelType.
|
56 |
model_config_dict={"temperature": 0},
|
57 |
),
|
58 |
"web": ModelFactory.create(
|
59 |
model_platform=ModelPlatformType.GROQ,
|
60 |
-
model_type=ModelType.
|
61 |
model_config_dict={"temperature": 0},
|
62 |
),
|
63 |
"planning": ModelFactory.create(
|
64 |
model_platform=ModelPlatformType.GROQ,
|
65 |
-
model_type=ModelType.
|
66 |
model_config_dict={"temperature": 0},
|
67 |
),
|
68 |
"video": ModelFactory.create(
|
69 |
model_platform=ModelPlatformType.GROQ,
|
70 |
-
model_type=ModelType.
|
71 |
model_config_dict={"temperature": 0},
|
72 |
),
|
73 |
"image": ModelFactory.create(
|
74 |
model_platform=ModelPlatformType.GROQ,
|
75 |
-
model_type=ModelType.
|
76 |
model_config_dict={"temperature": 0},
|
77 |
),
|
78 |
"document": ModelFactory.create(
|
79 |
model_platform=ModelPlatformType.GROQ,
|
80 |
-
model_type=ModelType.
|
81 |
model_config_dict={"temperature": 0},
|
82 |
),
|
83 |
}
|
@@ -129,6 +144,9 @@ def main():
|
|
129 |
question = "Navigate to Amazon.com and identify one product that is attractive to coders. Please provide me with the product name and price. No need to verify your answer."
|
130 |
|
131 |
# Construct and run the society
|
|
|
|
|
|
|
132 |
society = construct_society(question)
|
133 |
answer, chat_history, token_count = run_society(society)
|
134 |
|
|
|
11 |
# See the License for the specific language governing permissions and
|
12 |
# limitations under the License.
|
13 |
# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
|
14 |
+
|
15 |
+
"""
|
16 |
+
This module provides integration with the Groq API platform for the OWL system.
|
17 |
+
|
18 |
+
It configures different agent roles with appropriate Groq models based on their requirements:
|
19 |
+
- Tool-intensive roles (assistant, web, planning, video, image) use GROQ_LLAMA_3_3_70B
|
20 |
+
- Document processing uses GROQ_MIXTRAL_8_7B
|
21 |
+
- Simple roles (user) use GROQ_LLAMA_3_1_8B
|
22 |
+
|
23 |
+
To use this module:
|
24 |
+
1. Set GROQ_API_KEY in your .env file
|
25 |
+
2. Set OPENAI_API_BASE_URL to "https://api.groq.com/openai/v1"
|
26 |
+
3. Run with: python -m owl.run_groq
|
27 |
+
"""
|
28 |
+
|
29 |
from dotenv import load_dotenv
|
30 |
from camel.models import ModelFactory
|
31 |
from camel.toolkits import (
|
|
|
62 |
models = {
|
63 |
"user": ModelFactory.create(
|
64 |
model_platform=ModelPlatformType.GROQ,
|
65 |
+
model_type=ModelType.GROQ_LLAMA_3_1_8B, # Simple role, can use 8B model
|
66 |
model_config_dict={"temperature": 0},
|
67 |
),
|
68 |
"assistant": ModelFactory.create(
|
69 |
model_platform=ModelPlatformType.GROQ,
|
70 |
+
model_type=ModelType.GROQ_LLAMA_3_3_70B, # Main assistant needs tool capability
|
71 |
model_config_dict={"temperature": 0},
|
72 |
),
|
73 |
"web": ModelFactory.create(
|
74 |
model_platform=ModelPlatformType.GROQ,
|
75 |
+
model_type=ModelType.GROQ_LLAMA_3_3_70B, # Web browsing requires tool usage
|
76 |
model_config_dict={"temperature": 0},
|
77 |
),
|
78 |
"planning": ModelFactory.create(
|
79 |
model_platform=ModelPlatformType.GROQ,
|
80 |
+
model_type=ModelType.GROQ_LLAMA_3_3_70B, # Planning requires complex reasoning
|
81 |
model_config_dict={"temperature": 0},
|
82 |
),
|
83 |
"video": ModelFactory.create(
|
84 |
model_platform=ModelPlatformType.GROQ,
|
85 |
+
model_type=ModelType.GROQ_LLAMA_3_3_70B, # Video analysis is multimodal
|
86 |
model_config_dict={"temperature": 0},
|
87 |
),
|
88 |
"image": ModelFactory.create(
|
89 |
model_platform=ModelPlatformType.GROQ,
|
90 |
+
model_type=ModelType.GROQ_LLAMA_3_3_70B, # Image analysis is multimodal
|
91 |
model_config_dict={"temperature": 0},
|
92 |
),
|
93 |
"document": ModelFactory.create(
|
94 |
model_platform=ModelPlatformType.GROQ,
|
95 |
+
model_type=ModelType.GROQ_MIXTRAL_8_7B, # Document processing can use Mixtral
|
96 |
model_config_dict={"temperature": 0},
|
97 |
),
|
98 |
}
|
|
|
144 |
question = "Navigate to Amazon.com and identify one product that is attractive to coders. Please provide me with the product name and price. No need to verify your answer."
|
145 |
|
146 |
# Construct and run the society
|
147 |
+
# Note: This configuration uses GROQ_LLAMA_3_3_70B for tool-intensive roles (assistant, web, planning, video, image)
|
148 |
+
# and GROQ_MIXTRAL_8_7B for document processing. GROQ_LLAMA_3_1_8B is used only for the user role
|
149 |
+
# which doesn't require tool usage capabilities.
|
150 |
society = construct_society(question)
|
151 |
answer, chat_history, token_count = run_society(society)
|
152 |
|