together.Complete.create()

  • prompt (string, required) -- A string providing context for the model to complete
  • model (string, optional) -- Model string to query. Default: togethercomputer/RedPajama-INCITE-7B-Chat
  • max_tokens (integer, optional) -- Maximum number of tokens the model should generate. Default: 128
  • stop (List[str], optional) -- List of stop words the model should stop generation at. Default: ["<human>"]
  • temperature(float, optional) -- A decimal number that determines the degree of randomness in the response. Default: 0.7
  • top_p (float, optional) -- Used to dynamically adjust the number of choices for each predicted token based on the cumulative probabilities. A value of 1 will always yield the same output. A temperature less than 1 favors more correctness and is appropriate for question answering or summarization. A value greater than 1 introduces more randomness in the output. Default: 0.7
  • top_k (integer, optional) -- Used to limit the number of choices for the next predicted word or token. It specifies the maximum number of tokens to consider at each step, based on their probability of occurrence. This technique helps to speed up the generation process and can improve the quality of the generated text by focusing on the most likely options. Default: 50
  • repetition_penalty (float, optional) -- A number that controls the diversity of generated text by reducing the likelihood of repeated sequences. Higher values decrease repetition. Default: 1

Example:

import together

together.api_key = "xxxxx"

# generate response
response = together.Complete.create(prompt="List places to visit in San Francisco.")

print(response)

together.Complete.create_streaming()

  • prompt (string, required) -- A string providing context for the model to complete
  • model (string, optional) -- Model string to query. Default: togethercomputer/RedPajama-INCITE-7B-Chat
  • max_tokens (integer, optional) -- Maximum number of tokens the model should generate. Default: 128
  • stop (List[str], optional) -- List of stop words the model should stop generation at. Default: ["<human>"]
  • temperature(float, optional) -- A decimal number that determines the degree of randomness in the response. Default: 0.7
  • top_p (float, optional) -- Used to dynamically adjust the number of choices for each predicted token based on the cumulative probabilities. A value of 1 will always yield the same output. A temperature less than 1 favors more correctness and is appropriate for question answering or summarization. A value greater than 1 introduces more randomness in the output. Default: 0.7
  • top_k (integer, optional) -- Used to limit the number of choices for the next predicted word or token. It specifies the maximum number of tokens to consider at each step, based on their probability of occurrence. This technique helps to speed up the generation process and can improve the quality of the generated text by focusing on the most likely options. Default: 50
  • repetition_penalty (float, optional) -- A number that controls the diversity of generated text by reducing the likelihood of repeated sequences. Higher values decrease repetition. Default: 1

Example:

import together

together.api_key = "xxxxx"

prompt = "List places to visit in San Francisco."

for token in together.Complete.create_streaming(prompt=prompt):
    print(token, end="", flush=True)
print("\n")