calltogetherai

call_togetherai(prompt, model)

Calls the Together.ai API to generate a response to a given prompt.

Parameters:
  • prompt (str) – The prompt to send to the API.

  • model (str) – The name of the model to use. Should be one of the keys in the model_lookup_dict.

Returns:

The generated response content.

Return type:

str

Raises:
  • FileNotFoundError – If the “.local/togetherai.json” file is not found.

  • json.JSONDecodeError – If the “.local/togetherai.json” file contains invalid JSON.

  • Exception – If there is an error communicating with the Together.ai API or processing the response.