POST
/
completions
from together import Together
import os

client = Together(
api_key=os.environ.get("TOGETHER_API_KEY"),
)

response = client.completions.create(
model="meta-llama/Llama-2-70b-hf",
prompt="The largest city in France is",
)

print(response.choices[0].text)
{
  "id": "<string>",
  "choices": [
    {
      "text": "The capital of France is Paris. It's located in the north-central part of the country and is one of the most populous and visited cities in the world, known for its iconic landmarks like the Eiffel Tower, Louvre Museum, Notre-Dame Cathedral, and more. Paris is also the capital of the Île-de-France region and is a major global center for art, fashion, gastronomy, and culture.",
      "seed": 123,
      "finish_reason": "stop",
      "logprobs": {
        "token_ids": [
          123
        ],
        "tokens": [
          "<string>"
        ],
        "token_logprobs": [
          123
        ]
      }
    }
  ],
  "prompt": [
    {
      "text": "<s>[INST] What is the capital of France? [/INST]",
      "logprobs": {
        "token_ids": [
          123
        ],
        "tokens": [
          "<string>"
        ],
        "token_logprobs": [
          123
        ]
      }
    }
  ],
  "usage": {
    "prompt_tokens": 123,
    "completion_tokens": 123,
    "total_tokens": 123
  },
  "created": 123,
  "model": "<string>",
  "object": "text.completion"
}

Authorizations

Authorization
string
header
default:default
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json

Response

200
application/json

200

The response is of type object.