Skip to content

Commit 32f19f5

Browse files
authored
fix: output_language setting in ChatAgent (#1165)
1 parent 62f0c90 commit 32f19f5

26 files changed

+61
-56
lines changed

.github/ISSUE_TEMPLATE/bug_report.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ body:
2626
attributes:
2727
label: What version of camel are you using?
2828
description: Run command `python3 -c 'print(__import__("camel").__version__)'` in your shell and paste the output here.
29-
placeholder: E.g., 0.2.6
29+
placeholder: E.g., 0.2.7
3030
validations:
3131
required: true
3232

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ conda create --name camel python=3.10
144144
conda activate camel
145145
146146
# Clone github repo
147-
git clone -b v0.2.6 https://github.com/camel-ai/camel.git
147+
git clone -b v0.2.7 https://github.com/camel-ai/camel.git
148148
149149
# Change directory into project directory
150150
cd camel

camel/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# limitations under the License.
1313
# =========== Copyright 2023 @ CAMEL-AI.org. All Rights Reserved. ===========
1414

15-
__version__ = '0.2.6'
15+
__version__ = '0.2.7'
1616

1717
__all__ = [
1818
'__version__',

camel/agents/chat_agent.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -180,9 +180,6 @@ def __init__(
180180
model_type=ModelType.DEFAULT,
181181
)
182182
)
183-
self.output_language: Optional[str] = output_language
184-
if self.output_language is not None:
185-
self.set_output_language(self.output_language)
186183

187184
self.model_type = self.model_backend.model_type
188185

@@ -218,6 +215,10 @@ def __init__(
218215
context_creator, window_size=message_window_size
219216
)
220217

218+
self.output_language: Optional[str] = output_language
219+
if self.output_language is not None:
220+
self.set_output_language(self.output_language)
221+
221222
self.terminated: bool = False
222223
self.response_terminators = response_terminators or []
223224
self.init_messages()
@@ -371,13 +372,19 @@ def set_output_language(self, output_language: str) -> BaseMessage:
371372
self._system_message = self.orig_sys_message.create_new_instance(
372373
content
373374
)
374-
return self._system_message
375375
else:
376376
self._system_message = BaseMessage.make_assistant_message(
377377
role_name="Assistant",
378378
content=language_prompt,
379379
)
380-
return self._system_message
380+
381+
system_record = MemoryRecord(
382+
message=self._system_message,
383+
role_at_backend=OpenAIBackendRole.SYSTEM,
384+
)
385+
self.memory.clear()
386+
self.memory.write_record(system_record)
387+
return self._system_message
381388

382389
def get_info(
383390
self,

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
project = 'CAMEL'
2828
copyright = '2024, CAMEL-AI.org'
2929
author = 'CAMEL-AI.org'
30-
release = '0.2.6'
30+
release = '0.2.7'
3131

3232
html_favicon = (
3333
'https://raw.githubusercontent.com/camel-ai/camel/master/misc/favicon.png'

docs/cookbooks/agents_message.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@
101101
},
102102
"outputs": [],
103103
"source": [
104-
"!pip install \"camel-ai==0.2.6\""
104+
"!pip install \"camel-ai==0.2.7\""
105105
]
106106
},
107107
{

docs/cookbooks/agents_prompting.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
},
6565
"outputs": [],
6666
"source": [
67-
"!pip install \"camel-ai==0.2.6\""
67+
"!pip install \"camel-ai==0.2.7\""
6868
]
6969
},
7070
{

docs/cookbooks/agents_society.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@
192192
},
193193
"outputs": [],
194194
"source": [
195-
"!pip install \"camel-ai==0.2.6\""
195+
"!pip install \"camel-ai==0.2.7\""
196196
]
197197
},
198198
{

docs/cookbooks/agents_tracking.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
},
6565
"outputs": [],
6666
"source": [
67-
"%pip install camel-ai[all]==0.2.6\n",
67+
"%pip install camel-ai[all]==0.2.7\n",
6868
"%pip install agentops==0.3.10"
6969
]
7070
},

docs/cookbooks/agents_with_memory.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
},
7474
"outputs": [],
7575
"source": [
76-
"!pip install \"camel-ai[all]==0.2.6\""
76+
"!pip install \"camel-ai[all]==0.2.7\""
7777
]
7878
},
7979
{

0 commit comments

Comments
 (0)