mirror of
https://github.com/nomic-ai/gpt4all.git
synced 2024-10-01 01:06:10 -04:00
Update README.md to include inference example
Signed-off-by: Andriy Mulyar <andriy.mulyar@gmail.com>
This commit is contained in:
parent
a67f8132e1
commit
390994ea5e
@ -43,3 +43,29 @@ localhost:80/docs
|
|||||||
```
|
```
|
||||||
|
|
||||||
This documentation should match the OpenAI OpenAPI spec located at https://github.com/openai/openai-openapi/blob/master/openapi.yaml
|
This documentation should match the OpenAI OpenAPI spec located at https://github.com/openai/openai-openapi/blob/master/openapi.yaml
|
||||||
|
|
||||||
|
|
||||||
|
#### Running inference
|
||||||
|
```python
|
||||||
|
import openai
|
||||||
|
openai.api_base = "http://localhost:4891/v1"
|
||||||
|
|
||||||
|
openai.api_key = "not needed for a local LLM"
|
||||||
|
|
||||||
|
|
||||||
|
def test_completion():
|
||||||
|
model = "gpt4all-j-v1.3-groovy"
|
||||||
|
prompt = "Who is Michael Jordan?"
|
||||||
|
response = openai.Completion.create(
|
||||||
|
model=model,
|
||||||
|
prompt=prompt,
|
||||||
|
max_tokens=50,
|
||||||
|
temperature=0.28,
|
||||||
|
top_p=0.95,
|
||||||
|
n=1,
|
||||||
|
echo=True,
|
||||||
|
stream=False
|
||||||
|
)
|
||||||
|
assert len(response['choices'][0]['text']) > len(prompt)
|
||||||
|
print(response)
|
||||||
|
```
|
||||||
|
Loading…
Reference in New Issue
Block a user