diff --git a/gpt4all-bindings/python/docs/gpt4all_api.md b/gpt4all-bindings/python/docs/gpt4all_api.md index 9e0ca997..0f1a9162 100644 --- a/gpt4all-bindings/python/docs/gpt4all_api.md +++ b/gpt4all-bindings/python/docs/gpt4all_api.md @@ -1,4 +1,4 @@ -# GPT4All API +# GPT4All Python API The `GPT4All` provides a universal API to call all GPT4All models and introduces additional helpful functionality such as downloading models. diff --git a/gpt4all-bindings/python/docs/gpt4all_modal.md b/gpt4all-bindings/python/docs/gpt4all_modal.md new file mode 100644 index 00000000..d391cada --- /dev/null +++ b/gpt4all-bindings/python/docs/gpt4all_modal.md @@ -0,0 +1,35 @@ +# GPT4All with Modal Labs + +You can easily query any GPT4All model on [Modal Labs](https://modal.com/) infrastructure! +## Example + +```python +import modal + +def download_model(): + import gpt4all + #you can use any model from https://gpt4all.io/models/models.json + return gpt4all.GPT4All("ggml-gpt4all-j-v1.3-groovy.bin") + +image=modal.Image.debian_slim().pip_install("gpt4all").run_function(download_model) + +stub = modal.Stub("gpt4all", image=image) + +@stub.cls(keep_warm=1) +class GPT4All: + def __enter__(self): + print("Downloading model") + self.gptj = download_model() + print("Loaded model") + + def generate(self): + messages = [{"role": "user", "content": "Name 3 colors"}] + completion = self.gptj.chat_completion(messages) + print(f"Completion: {completion}") + +@stub.local_entrypoint() +def main(): + model = GPT4All() + for i in range(10): + model.generate() +``` diff --git a/gpt4all-bindings/python/docs/index.md b/gpt4all-bindings/python/docs/index.md index 788daf8d..7c586462 100644 --- a/gpt4all-bindings/python/docs/index.md +++ b/gpt4all-bindings/python/docs/index.md @@ -1,4 +1,4 @@ -# GPT4All +# GPT4All with Python In this package, we introduce Python bindings built around GPT4All's C/C++ model backends. diff --git a/gpt4all-bindings/python/mkdocs.yml b/gpt4all-bindings/python/mkdocs.yml index b5ecdcc4..e72c78c9 100644 --- a/gpt4all-bindings/python/mkdocs.yml +++ b/gpt4all-bindings/python/mkdocs.yml @@ -1,14 +1,15 @@ -site_name: GPT4All Python Documentation +site_name: GPT4All Documentation repo_url: https://github.com/nomic-ai/gpt4all repo_name: nomic-ai/gpt4all site_url: https://docs.nomic.ai # TODO: change edit_uri: edit/main/docs/ -site_description: Python bindings for GPT4All +site_description: Documentation for running GPT4All anywhere. copyright: Copyright © 2023 Nomic, Inc use_directory_urls: false nav: - 'index.md' + - 'gpt4all_modal.md' - 'API Reference': - 'gpt4all_api.md'