ShinnosukeU commited on
Commit
0ef9839
·
verified ·
1 Parent(s): 29579ee

Upload folder using huggingface_hub

Browse files
client.py CHANGED
@@ -55,7 +55,7 @@ class AgentLanguageEnv(
55
  Dictionary representation suitable for JSON encoding
56
  """
57
  return {
58
- "message": action.message,
59
  }
60
 
61
  def _parse_result(self, payload: Dict) -> StepResult[AgentLanguageObservation]:
@@ -70,11 +70,9 @@ class AgentLanguageEnv(
70
  """
71
  obs_data = payload.get("observation", {})
72
  observation = AgentLanguageObservation(
73
- echoed_message=obs_data.get("echoed_message", ""),
74
- message_length=obs_data.get("message_length", 0),
75
  done=payload.get("done", False),
76
  reward=payload.get("reward"),
77
- metadata=obs_data.get("metadata", {}),
78
  )
79
 
80
  return StepResult(
 
55
  Dictionary representation suitable for JSON encoding
56
  """
57
  return {
58
+ "language_specification": action.language_specification,
59
  }
60
 
61
  def _parse_result(self, payload: Dict) -> StepResult[AgentLanguageObservation]:
 
70
  """
71
  obs_data = payload.get("observation", {})
72
  observation = AgentLanguageObservation(
73
+ message=obs_data.get("message", ""),
 
74
  done=payload.get("done", False),
75
  reward=payload.get("reward"),
 
76
  )
77
 
78
  return StepResult(
server/agent_language_environment.py CHANGED
@@ -13,11 +13,10 @@ Perfect for testing HTTP server infrastructure.
13
 
14
  from uuid import uuid4
15
 
 
16
  from models import AgentLanguageAction, AgentLanguageObservation, AgentLanguageState
17
  from openenv.core.env_server.interfaces import Environment
18
 
19
- from evaluate_protocal import evaluate_lang_spec
20
-
21
  COMMUNICATION_PROTOCAL_PROMPT = """"You are generating a communication protocol between two agents. Produce language specification that **minimize** the number of tokens needed for a single exchange while preserving clarity. This could be some abbreviation synonyms or some template for the communication. Your communication protocal might be detailed and should include examples of the communication. Try not to limit the amount of actual information that is passed to each agent. Instead forcus on formtting of the communication, and telling the agents to abbreviate and make the communication as short as possible. The communication protocal itsefl does not need to be concise, it should be in natural language with full sentences, even paragraphs if needed, and easy to understand.
22
 
23
  Example:
@@ -83,10 +82,10 @@ class AgentLanguageEnvironment(Environment):
83
  AgentLanguageObservation with the echoed message and its length
84
  """
85
  self._state.step_count += 1
86
- message = action.message
87
- reward = evaluate_lang_spec(message)
88
  return AgentLanguageObservation(
89
- echoed_message=message,
90
  done=True,
91
  reward=reward,
92
  #metadata={"original_message": message, "step": self._state.step_count},
 
13
 
14
  from uuid import uuid4
15
 
16
+ from evaluate_protocal import evaluate_lang_spec
17
  from models import AgentLanguageAction, AgentLanguageObservation, AgentLanguageState
18
  from openenv.core.env_server.interfaces import Environment
19
 
 
 
20
  COMMUNICATION_PROTOCAL_PROMPT = """"You are generating a communication protocol between two agents. Produce language specification that **minimize** the number of tokens needed for a single exchange while preserving clarity. This could be some abbreviation synonyms or some template for the communication. Your communication protocal might be detailed and should include examples of the communication. Try not to limit the amount of actual information that is passed to each agent. Instead forcus on formtting of the communication, and telling the agents to abbreviate and make the communication as short as possible. The communication protocal itsefl does not need to be concise, it should be in natural language with full sentences, even paragraphs if needed, and easy to understand.
21
 
22
  Example:
 
82
  AgentLanguageObservation with the echoed message and its length
83
  """
84
  self._state.step_count += 1
85
+ language_specification = action.language_specification
86
+ reward = evaluate_lang_spec(language_specification)
87
  return AgentLanguageObservation(
88
+ message="Do not call any more function.",
89
  done=True,
90
  reward=reward,
91
  #metadata={"original_message": message, "step": self._state.step_count},