Skip to content

Commit 32c35a0

Browse files
sphinx doc for using GPT-4 in Python module
1 parent 81d7a01 commit 32c35a0

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

docs/python_module.rst

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,22 @@ To pass custom configuration to the ``ApiBackend``, use the ``Config`` class:
4242
print(response)
4343
else:
4444
raise RuntimeError(message)
45+
46+
47+
-----------------------------------------------
48+
GPT-4
49+
-----------------------------------------------
50+
51+
To use GPT-4 within your Python code, you must use :ref:`presets_doc`.
52+
53+
The code below uses the system-defined ``gpt-4-chatbot-responses`` preset:
54+
55+
.. code-block:: python
56+
57+
from lwe import ApiBackend
58+
from lwe.core.config import Config
59+
60+
config = Config()
61+
config.set('model.default_preset', 'gpt-4-chatbot-responses')
62+
bot = ApiBackend(config)
63+
success, response, message = bot.ask("Hello, world!")

0 commit comments

Comments
 (0)