Request Parameters
This guide provides an overview of the Completion endpoint in Konko's API, designed for generating text based on a single input prompt.
Model
Parameter
Model
ParameterSelecting the appropriate model is crucial for the quality and relevance of the output. Each model specializes in different tasks. For model options, visit: List of Available Models.
Prompt
Parameter
Prompt
ParameterThe prompt
to generate completions for, encoded as a string.
Advanced Parameters
- max_tokens: Sets the maximum length for the generated text.
- temperature: Adjusts randomness in the response (0 to 1). Higher values yield more varied outputs.
- top_p: Controls the breadth of possible responses. Higher values lead to more diverse results.
- n: Determines the number of completions to generate per prompt.
- stop: Sequences signaling the model to stop generating text.
- presence_penalty/frequency_penalty: Modifies token generation based on their frequency or presence.
- logit_bias: Influences the likelihood of specific tokens appearing in the completion.
- seed: For deterministic outputs, ensuring repeat requests yield the same result.
- stream: Enables real-time streaming of the generated text.
Example SDK Usage
import konko
response = konko.completions.create(
model="meta-llama/llama-2-13b",
prompt="Summarize the Foundation by Isaac Asimov",
max_tokens=500
)
print(response)
Output
Shows the structure of the generated text based on the provided prompt and parameters.
Completion(id='82c4fe31-4d48-487c-a409-1aedb2738ac3',
choices=[
CompletionChoice
(
finish_reason=None,
index=0,
logprobs=None,
text='\nThe Foundation by Isaac Asimov is a science fiction novel that tells the story of a group of scientists who are trying to save humanity from extinction. The novel is set in the future, and it follows the story of Hari Seldon, a scientist who has developed a new field of study called psychohistory. Psychohistory is a way of predicting the future by studying the behavior of large groups of people.\nSeldon uses psychohistory to predict that the Galactic Empire will fall, and he creates a plan to save humanity from the chaos that will follow. The Foundation is a group of scientists who are working to preserve human knowledge and culture in the face of the Empire’s collapse.\nThe Foundation is a classic science fiction novel that is still relevant today. The novel explores themes of power, corruption, and the importance of knowledge. The Foundation is a must-read for any fan of science fiction.\nThe Foundation by Isaac Asimov is a science fiction novel that tells the story of a group of scientists who are trying to save humanity from extinction. The novel is set in the future, and it follows the story of Hari Seldon, a scientist who has developed a new field of study called psychohistory. Psychohistory is a way of predicting the future by studying the behavior of large groups of people.\nThe Foundation is a classic science fiction novel that is still relevant today. The novel explores themes of power, corruption, and the importance of knowledge. The Foundation is a must-read for any fan of science fiction. The Foundation by Isaac Asimov is a science fiction novel that tells the story of a group of scientists who are trying to save humanity from extinction. The novel is set in the future, and it follows the story of Hari Seldon, a scientist who has developed a new field of study called psychohistory. Psychohistory is a way of predicting the future by studying the behavior of large groups of people.\nThe Foundation is a classic science fiction novel that is still relevant today. The novel explores themes of power, corruption, and the importance of knowledge. The Foundation is a must-read for any fan of science fiction. The Foundation by Isaac Asimov is a science fiction novel that tells the story of a group of scientists who are trying'
)
],
created=1704895437,
model='meta-llama/llama-2-13b',
object='text_completion',
system_fingerprint=None,
usage=None
)
Updated 9 months ago