Skip to content

Commit fdc13ee

Browse files
Merge pull request anthropics#5 from Intuit-A4A/fix-model-feedback
FIX: make sure we are consistent about prediction id
2 parents 3b3cd36 + 7283da9 commit fdc13ee

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

player-service-model/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Player Service Model
22

3-
This is a thin model wrapper container based on `Player.csv` data.
3+
This is a thin model wrapper container based on `Player.csv` data.
44

55
To build and run:
66
```shell
@@ -13,11 +13,11 @@ This will expose port 5000.
1313
To send data to the trad AI model:
1414
```shell
1515
$ curl -H "Content-type: application/json" -d '{"seed_id":"abbotji01","team_size":10}' http://127.0.0.1:5000/team/generate
16-
{"seed_id":"abbotji01","team_size":10,"member_ids":["abbotji01","combspa01","maurero01","cummijo01","flemida01","macdobo01","eddych01","morriha02","mcgrifr01","blossgr01"]}
16+
{"seed_id":"abbotji01","prediction_id":"38f5f02f-b1be-4282-8d0e-865b3995d50a","team_size":10,"member_ids":["abbotji01","combspa01","maurero01","cummijo01","flemida01","macdobo01","eddych01","morriha02","mcgrifr01","blossgr01"]}
1717
```
1818

1919
To send feedback:
2020
```shell
21-
$ curl -H "Content-type: application/json" -d '{"seed_id":"abbotji01","member_id":"maurero01","feedback":-1}' http://127.0.0.1:5000/team/feedback
22-
{"seed_id":"abbotji01","member_id":"maurero01","accepted":true}
23-
```
21+
$ curl -H "Content-type: application/json" -d '{"seed_id":"abbotji01","member_id":"maurero01","feedback":-1,"prediction_id":"38f5f02f-b1be-4282-8d0e-865b3995d50a"}' http://127.0.0.1:5000/team/feedback
22+
{"seed_id":"abbotji01","member_id":"maurero01","accepted":true,"prediction_id":"38f5f02f-b1be-4282-8d0e-865b3995d50a"}
23+
```

player-service-model/a4a_model/server.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ class TeamFeedbackInput(BaseModel):
6464
seed_id: str
6565
member_id: str
6666
feedback: Literal[-1, 1] # expect -1 or 1
67+
prediction_id: str
68+
6769

6870
class TeamFeedbackOutput(BaseModel):
6971
seed_id: str
@@ -123,6 +125,7 @@ def generate_team(body: TeamGenerateInput) -> TeamGenerateOutput:
123125
def team_feedback(body: TeamFeedbackInput) -> TeamFeedbackOutput:
124126
seed_id = body.seed_id
125127
member_id = body.member_id
128+
prediction_id = body.prediction_id
126129
accepted = True
127130
if seed_id not in all_players:
128131
accepted = False
@@ -135,7 +138,8 @@ def team_feedback(body: TeamFeedbackInput) -> TeamFeedbackOutput:
135138
return TeamFeedbackOutput(
136139
seed_id=seed_id,
137140
member_id=member_id,
138-
accepted=accepted
141+
accepted=accepted,
142+
prediction_id=prediction_id or str(uuid.uuid4()),
139143
)
140144

141145

0 commit comments

Comments
 (0)