API Reference - Kerdos-Infrasoft-Private-Limited/Kerdos-Infrasoft GitHub Wiki

KerdosAI Class

The main class to interact with Kerdos AI for text generation.

API Reference

This section provides detailed information on the core classes and methods available in the Kerdos AI Python library.


KerdosAI Class

The main class to interact with Kerdos AI for text generation.

Initialization

KerdosAI(max_length=100, temperature=0.7, top_p=0.9)

Parameters:

Parameter Type Default Description
max_length int 100 Maximum length of generated text
temperature float 0.7 Sampling temperature for generation
top_p float 0.9 Nucleus sampling parameter

Methods

generate(prompt: str, max_length: int = None, temperature: float = None, top_p: float = None) -> str

Generate text based on the input prompt.

Parameters:

Parameter Type Default Description
prompt str Input text prompt to generate from
max_length int None Override default max_length for this call
temperature float None Override default temperature for this call
top_p float None Override default top_p for this call

Returns:

  • str — The generated text output.

Example Usage

from kerdosai import KerdosAI

model = KerdosAI(max_length=50, temperature=0.8)
response = model.generate("Kerdos AI is")
print(response)

Additional Notes

  • All parameters are optional except prompt in generate().
  • Adjusting temperature controls randomness (lower is more deterministic).
  • top_p controls nucleus sampling to focus on more likely words.

For more information and advanced configurations, visit the [GitHub Repository](https://github.com/kerdosdotio/kerdosai) and official documentation.

© 2025 Kerdos Infrasoft Private Limited