mirror of
https://github.com/hwchase17/langchain
synced 2024-11-08 07:10:35 +00:00
c4cb55a0c5
Seems the pyllamacpp package is no longer the supported bindings from gpt4all. Tested that this works locally. Given that the older models weren't very performant, I think it's better to migrate now without trying to include a lot of try / except blocks --------- Co-authored-by: Nissan Pow <npow@users.noreply.github.com> Co-authored-by: Nissan Pow <pownissa@amazon.com>
26 lines
639 B
Python
26 lines
639 B
Python
# flake8: noqa
|
|
"""Test Llama.cpp wrapper."""
|
|
import os
|
|
from urllib.request import urlretrieve
|
|
|
|
from langchain.llms import GPT4All
|
|
|
|
|
|
def _download_model() -> str:
|
|
"""Download model."""
|
|
model_url = "http://gpt4all.io/models/ggml-gpt4all-l13b-snoozy.bin"
|
|
local_filename = model_url.split("/")[-1]
|
|
|
|
if not os.path.exists(local_filename):
|
|
urlretrieve(model_url, local_filename)
|
|
|
|
return local_filename
|
|
|
|
|
|
def test_gpt4all_inference() -> None:
|
|
"""Test valid gpt4all inference."""
|
|
model_path = _download_model()
|
|
llm = GPT4All(model=model_path)
|
|
output = llm("Say foo:")
|
|
assert isinstance(output, str)
|