Skip to main content

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

Usage

Importing the library

from kognie 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 generation
  • model (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 generation
  • model (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

kognie_api-0.1.4.tar.gz (2.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kognie_api-0.1.4-py3-none-any.whl (2.7 kB view details)

Uploaded Python 3

File details

Details for the file kognie_api-0.1.4.tar.gz.

File metadata

  • Download URL: kognie_api-0.1.4.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

Hashes for kognie_api-0.1.4.tar.gz
Algorithm Hash digest
SHA256 954a90289d9bb0114a6f86978985764ce51ad82858b4f6d68a4ac2d8b57d99d0
MD5 37dc39c5576d34f259a3615b62afd1b5
BLAKE2b-256 47ef121b51b633c40780ba5dc42e2def59c9df42e211ed8ff5b90587a4566f4d

See more details on using hashes here.

File details

Details for the file kognie_api-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: kognie_api-0.1.4-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

Hashes for kognie_api-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 967a2883726b3520e5562a5e3150bcc27b2d24390f3d47b47b32234ef801cc32
MD5 c3c608a2ec96735d62b91044430d3a9d
BLAKE2b-256 6900290b4875ec68e5cae448c851625508e6262c311cbe1fa0406b030d5455e9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page