From 72c01024cb182a3b4671774fdbaad44631a7c372 Mon Sep 17 00:00:00 2001 From: henceiusegentoo Date: Mon, 7 Aug 2023 16:15:45 +0200 Subject: [PATCH] Updated readme --- README.md | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 9d3a1d7..75df0c7 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ Now, to make a request, use the `make_request` function. For example: from nova_python import Endpoints, Models, NovaClient client = NovaClient("YOUR_API_KEY") -client.make_request( +reponse = client.make_request( endpoint=Endpoints.CHAT_COMPLETION, model=Models.GPT3, data=[ @@ -44,6 +44,8 @@ client.make_request( {"role": "user", "content": "Hello!"} ] ) + +... ``` or @@ -52,15 +54,36 @@ or from nova_python import Endpoints, Models, NovaClient client = NovaClient("YOUR_API_KEY") -client.make_request( +reponse = client.make_request( endpoint=Endpoints.MODERATION, model=Models.MODERATION_STABLE, data=[{"input": "I'm going to kill them."}] ) + +... +``` +If everything goes to plan, you'll receive a string containing JSON-Data, which you can then use in your project. + +Note, that when using chat completion, as special ChatResponse-Instance get's returned. +You can access the reponse's json.data, by casting it to a string using the `str` method, like this: +```python +... + +str(reponse) + +... +``` + +but more importantly, you can use it's `get_message_content` function, to directly get access to the chat reponse. Used like this: +``` +... + +content = reponse.get_message_content() + +... ``` -If everything goes to plan, you'll receive a string containing JSON-Data, which you can then use in your project. *Happy prompting!*

## FAQ ##