Skip to content

Commit

Permalink
Refactor OpenAIMiner and related classes
Browse files Browse the repository at this point in the history
  • Loading branch information
ulises-jeremias committed Feb 26, 2024
1 parent ff78dfe commit 61ecfa4
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 8 deletions.
4 changes: 2 additions & 2 deletions neurons/miners/openai/miner.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,10 @@ async def forward(
This method should be replaced with actual logic relevant to the miner's purpose.
Args:
synapse (prompting.protocol.Prompting): The synapse object containing the 'dummy_input' data.
synapse (prompting.protocol.Prompting): The synapse object containing prompt data.
Returns:
prompting.protocol.Prompting: The synapse object with the 'dummy_output' field set to twice the 'dummy_input' value.
prompting.protocol.Prompting: The synapse object with the completion data.
The 'forward' function is a placeholder and should be overridden with logic that is appropriate for
the miner's intended operation. This method demonstrates a basic transformation of input data.
Expand Down
1 change: 0 additions & 1 deletion prompting/validator/forward.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ async def forward(self):
responses = await self.dendrite(
# Send the query to selected miner axons in the network.
axons=[self.metagraph.axons[uid] for uid in miner_uids],
# Construct a dummy query. This simply contains a single integer.
synapse=prompting,
# All responses have the deserialize function called on them before returning.
# You are encouraged to define your own deserialization function.
Expand Down
2 changes: 1 addition & 1 deletion prompting/validator/reward.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

def reward(query: int, response: int) -> float:
"""
Reward the miner response to the dummy request. This method returns a reward
Reward the miner response to the prompting request. This method returns a reward
value for the miner, which is used to update the miner's score.
Returns:
Expand Down
4 changes: 2 additions & 2 deletions tests/test_mock.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,11 @@ async def run():
if dendrite.process_time >= timeout + 0.1:
assert dendrite.status_code == 408
assert dendrite.status_message == 'Timeout'
assert synapse.dummy_output == synapse.dummy_input
assert synapse.content == ""
# check that responses which take less than timeout have 200 status code
elif dendrite.process_time < timeout:
assert dendrite.status_code == 200
assert dendrite.status_message == 'OK'
# check that outputs are not empty for successful responses
assert synapse.dummy_output == synapse.dummy_input * 2
assert synapse.content == ""
# dont check for responses which take between timeout and max_time because they are not guaranteed to have a status code of 200 or 408
4 changes: 2 additions & 2 deletions tests/test_template_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ def test_forward(self):
# TODO: Test that the forward function returns the correct value
pass

def test_dummy_responses(self):
# TODO: Test that the dummy responses are correctly constructed
def test_prompting_responses(self):
# TODO: Test that the prompting responses are correctly constructed

# Assuming Synapse provides certain functionalities required for integration
prompting = Prompting(
Expand Down

0 comments on commit 61ecfa4

Please sign in to comment.