2023-05-01 06:09:25 +09:00
|
|
|
### Example: `forefront` (use like openai pypi package) <a name="example-forefront"></a>
|
|
|
|
|
|
|
|
```python
|
|
|
|
from gpt4free import forefront
|
2023-05-08 01:31:14 +09:00
|
|
|
|
|
|
|
|
2023-05-01 06:09:25 +09:00
|
|
|
# create an account
|
2023-05-08 01:31:14 +09:00
|
|
|
account_data = forefront.Account.create(logging=False)
|
|
|
|
|
2023-05-01 06:09:25 +09:00
|
|
|
# get a response
|
2023-05-01 18:49:18 +09:00
|
|
|
for response in forefront.StreamingCompletion.create(
|
2023-05-08 01:31:14 +09:00
|
|
|
account_data=account_data,
|
|
|
|
prompt='hello world',
|
|
|
|
model='gpt-4'
|
2023-05-01 18:49:18 +09:00
|
|
|
):
|
|
|
|
print(response.choices[0].text, end='')
|
2023-05-01 06:09:25 +09:00
|
|
|
print("")
|
2023-05-08 01:31:14 +09:00
|
|
|
|
2023-05-01 06:09:25 +09:00
|
|
|
```
|