Skip to content

Commit

Permalink
Copybara import of the project:
Browse files Browse the repository at this point in the history
--
91b4ad2 by Dennis-yxchen <[email protected]>:

Update ollama_model.py

there will be an error if using `response.response`
```
AttributeError: 'dict' object has no attribute 'response'
```
As a result, change `response.response` to `response['response']`
COPYBARA_INTEGRATE_REVIEW=#107 from Dennis-yxchen:patch-1 91b4ad2
PiperOrigin-RevId: 697596831
Change-Id: Ie48fbd274f17555fd7965f60ff7ef84852baff43
  • Loading branch information
Dennis-yxchen authored and copybara-github committed Nov 18, 2024
1 parent b758468 commit 9dd73cc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions concordia/language_model/ollama_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def sample_text(
options={'stop': terminators},
keep_alive='10m',
)
result = response.response
result = response['response']

if self._measurements is not None:
self._measurements.publish_datum(
Expand Down Expand Up @@ -127,7 +127,7 @@ def sample_choice(
keep_alive='10m',
)
try:
json_data_response = json.loads(response.response)
json_data_response = json.loads(response['response'])
except json.JSONDecodeError:
continue
sample_or_none = json_data_response.get('choice', None)
Expand Down

0 comments on commit 9dd73cc

Please sign in to comment.