| 
 | 1 | +# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========  | 
 | 2 | +# Licensed under the Apache License, Version 2.0 (the "License");  | 
 | 3 | +# you may not use this file except in compliance with the License.  | 
 | 4 | +# You may obtain a copy of the License at  | 
 | 5 | +#  | 
 | 6 | +#     http://www.apache.org/licenses/LICENSE-2.0  | 
 | 7 | +#  | 
 | 8 | +# Unless required by applicable law or agreed to in writing, software  | 
 | 9 | +# distributed under the License is distributed on an "AS IS" BASIS,  | 
 | 10 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  | 
 | 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 | +from camel.agents import ChatAgent  | 
 | 16 | +from camel.configs import ChatGPTConfig  | 
 | 17 | +from camel.models import ModelFactory  | 
 | 18 | +from camel.types import ModelPlatformType, ModelType  | 
 | 19 | + | 
 | 20 | +# Instantiate the O3_PRO reasoning model  | 
 | 21 | +o3_pro_model = ModelFactory.create(  | 
 | 22 | +    model_platform=ModelPlatformType.OPENAI,  | 
 | 23 | +    model_type=ModelType.O3_PRO,  | 
 | 24 | +    model_config_dict=ChatGPTConfig().as_dict(),  | 
 | 25 | +)  | 
 | 26 | + | 
 | 27 | +# Set up the chat agent with the O3_PRO model  | 
 | 28 | +camel_agent = ChatAgent(model=o3_pro_model)  | 
 | 29 | + | 
 | 30 | +# Example user message (multi-step reasoning/logic problem)  | 
 | 31 | +user_msg = (  | 
 | 32 | +    "A farmer has a 3-liter jug and a 5-liter jug. Neither jug has any "  | 
 | 33 | +    "measurement marks on it. How can the farmer measure exactly 4 liters of "  | 
 | 34 | +    "water using just these two jugs and unlimited water supply? "  | 
 | 35 | +    "Explain the steps."  | 
 | 36 | +)  | 
 | 37 | + | 
 | 38 | +# Get response from the agent  | 
 | 39 | +response = camel_agent.step(user_msg)  | 
 | 40 | +print(response.msgs[0].content)  | 
 | 41 | + | 
 | 42 | +'''  | 
 | 43 | +===============================================================================  | 
 | 44 | +Sample Output (O3_PRO Reasoning Model):  | 
 | 45 | +
  | 
 | 46 | +To measure exactly 4 liters with a 3-liter and a 5-liter jug:  | 
 | 47 | +
  | 
 | 48 | +1. Fill the 5-liter jug completely (5 liters).  | 
 | 49 | +2. Pour from the 5-liter jug into the 3-liter jug until the 3-liter jug is  | 
 | 50 | +   full.  | 
 | 51 | +   - Now, 5-liter jug has 2 liters left; 3-liter jug has 3 liters.  | 
 | 52 | +3. Empty the 3-liter jug.  | 
 | 53 | +   - Now, 5-liter jug has 2 liters; 3-liter jug is empty.  | 
 | 54 | +4. Pour the remaining 2 liters from the 5-liter jug into the 3-liter jug.  | 
 | 55 | +   - Now, 5-liter jug is empty; 3-liter jug has 2 liters.  | 
 | 56 | +5. Fill the 5-liter jug again (5 liters).  | 
 | 57 | +6. Pour from the 5-liter jug into the 3-liter jug until the 3-liter jug is  | 
 | 58 | +   full.  | 
 | 59 | +   - The 3-liter jug already has 2 liters, so you can add only 1 more liter.  | 
 | 60 | +   - Now, 5-liter jug has 4 liters left; 3-liter jug is full (3 liters).  | 
 | 61 | +
  | 
 | 62 | +**Result:** The 5-liter jug now contains exactly 4 liters of water.  | 
 | 63 | +===============================================================================  | 
 | 64 | +'''  | 
0 commit comments