Update ollama/_types.py

Co-authored-by: Parth Sareen <[email protected]>
This commit is contained in:
Jeffrey Morgan
2024-11-26 10:41:53 -08:00
committed by GitHub
co-authored by Parth Sareen
parent d8d98e17b2
commit d4c38978d1
+3
View File
@@ -93,6 +93,9 @@ class SubscriptableBaseModel(BaseModel):
>>> msg = Message(role='user')
>>> msg.get('nonexistent', 'default')
'default'
>>> msg = Message(role='user', tool_calls=[ Message.ToolCall(function=Message.ToolCall.Function(name='foo', arguments={}))])
>>> msg.get('tool_calls')[0]['function']['name']
'foo'
"""
return self[key] if key in self else default