No project description provided
Project description
Kognie Python API
A Python client for interacting with the Kognie API to generate text and images.
Installation
pip install kognie_api
Usage
Importing the library
from kognie_api import Kognie
Initialization
Create a new instance of the Kognie client with your API key.
kognie_client = Kognie(api_key="your_api_key_here")
Text Generation
Generate text using models like GPT-4. You can get the list of supported models at : https://kognie.com/models
# Generate text with default model (gpt-4)
response = kognie_client.generateText("What is the capital of France?")
print(response)
# Generate text with a specific model
response = kognie_client.generateText("What is the capital of France?", model="gpt-4o")
print(response)
Parameters
question(str): The prompt for text generationmodel(str, optional): The model to use (default: "gpt-4")
Image Generation
Generate images using models like DALL-E.
# Generate image with default parameters
response = kognie_client.generateImage("A sunset over mountains")
print(response)
# Generate image with specific parameters
response = kognie_client.generateImage(
question="A sunset over mountains",
model="dall-e-2",
response_format="base64",
aspect_ratio="1:1"
)
print(response)
Parameters
question(str): The prompt for image generationmodel(str, optional): The model to use (default: "dall-e-2")response_format(str, optional): Format of the response (default: "base64")aspect_ratio(str, optional): Aspect ratio of the generated image (default: "1:1")
Error Handling
The methods return a dictionary with the API response if successful. If an error occurs, they return a dictionary with an "error" key containing details about the error.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file kognie_api-0.1.5.tar.gz.
File metadata
- Download URL: kognie_api-0.1.5.tar.gz
- Upload date:
- Size: 2.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8aabda63809693b24dcc8fad2851d09f92c26430301b1d3423a8902b2faa24e1
|
|
| MD5 |
aed643e19be28935d31526c02e21b40c
|
|
| BLAKE2b-256 |
50f378e7b8bd76582989ffec57f0481f91f6b853370fad3d1693cebcc4636ef0
|
File details
Details for the file kognie_api-0.1.5-py3-none-any.whl.
File metadata
- Download URL: kognie_api-0.1.5-py3-none-any.whl
- Upload date:
- Size: 2.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
134101902897fee9b3846afee045cf88e33266fccb1cf2f5c53b68b7f4755711
|
|
| MD5 |
e2247af30bd1aac02f465cb01afe759c
|
|
| BLAKE2b-256 |
6eb4de17641859e5c06111aa5200842165a459c23b18cee5c6428f4638dbe6d0
|