add content-type and accept

mirrors header values set by ollama cli
This commit is contained in:
Michael Yang 2024-02-08 11:59:39 -08:00
parent 8b929ab496
commit ec8bf88c2b

View File

@ -47,7 +47,9 @@ class BaseClient:
"""
headers = kwargs.pop('headers', {})
headers['user-agent'] = f'ollama-python/{__version__} ({platform.machine()} {platform.system().lower()}) Python/{platform.python_version()}'
headers['Content-Type'] = 'application/json'
headers['Accept'] = 'application/json'
headers['User-Agent'] = f'ollama-python/{__version__} ({platform.machine()} {platform.system().lower()}) Python/{platform.python_version()}'
self._client = client(
base_url=_parse_host(host or os.getenv('OLLAMA_HOST')),