Completions API Documentation Seems Incomplete

I am having trouble finding a complete reference to:

client.chat.completions.create

I’ve found:

https://platform.openai.com/docs/guides/text-generation
https://platform.openai.com/docs/quickstart?context=python
https://cookbook.openai.com/examples/how_to_call_functions_with_chat_models
https://platform.openai.com/docs/api-reference

etc., but none has a complete description of the interface.

for example, I can do this:

def gpt_api_send_command(prompt, model=‘gpt-3.5-turbo’, max_lines=100):
client = OpenAI()
function_schema = {
“name”: “send_command”,
“description”: “Execute a command and return the output”,
“parameters”: {
“type”: “object”,
“properties”: {
“commandString”: {
“type”: “string”,
“description”: “The command to execute”
}
},
“required”: [“commandString”]
}
}

messages = [
    {"role": "user", "content": prompt},
]

print("About to make API call")
response = client.chat.completions.create(
    model=model,
    messages=messages,
    functions=[function_schema],
    function_call={"name": "send_command", "arguments": json.dumps({"commandString": "some command"})}
)
print("API call complete")

but I don’t see that anywhere in the docs. (I do see examples using tools as the input and functions within the tools ‘schema’, but I only found those in the cookbook, and nothing that implied only including functions, nor what the detailed options/implications happen to be, etc.)

It would be very helpful to have a complete reference for the completion interface. Does anyone know where to find something like that? If not, maybe a friendly developer at OpenAI or perhaps even some magnanimous member of the community might be so kind as to create something like that for us?

Thanks!

1 Like

I believe that’s the library, the docs on the endpoint are here… (Guide docs)

For functions and what-not, take a peek here… (API Reference)

The API-Reference side usually goes into more of the nitty gritty.

The OpenAI Cookbook and Quickstart guide are two other helpful links.

1 Like

Awesome! This is exactly what I was looking for:

https://platform.openai.com/docs/api-reference/chat/create

Not sure why I couldn’t find it before. Maybe I assumed endpoints were related to direct server interaction not api library interaction.

In hopes of helping the next person with a similar question, here is a clip of the type of information provided in the link:

It also includes details on functions, tools, and all the other interface components I wanted to better understand.

1 Like

And for the next person - just look at the links in the sidebar of this forum…

1 Like