Pull requests / #1175

#1175 serve: a tool's "parameters" / "input_schema" that is not an object is a 400 naming it, not an AttributeError on its first call (#592 follow-up)

closed · @Avicennasis · 0 comentarios · En GitHub

Server & API

Descripción

Follow-up to #635 / 0.1.39's #592 fix, as you offered there: the schema check.

`_tool_list` takes a tool with a name and lets its schema be anything. A `parameters` (OpenAI) or `input_schema` (Anthropic) that is a string, a number or a list passes the 400 and reaches `parse_tool_call` and `OutputParser` as the tool's schema, whose `.get("properties")` raises `AttributeError: 'str' object has no attribute 'get'` in the request thread the first time the model calls that tool. On 0.1.40.1's `main`, with the test suite's `CallingEngine` and a `tool_choice` naming a tool whose `parameters` is `"x"`: a non-streaming request gets the connection closed with no response (`RemoteDisconnected`); a streaming one gets a 200 and a stream that ends after the first, empty delta, with no error and no finish_reason.

Now a schema is an object when it is there (absent, null and `{}` go on as before); anything else is a 400 naming the tool's index, its name and the field, before anything is sent, on both APIs with the key each one uses. The test covers a string, a list and a number on `/v1/chat/completions` (wrapped and bare) and a string, a list and a boolean on `/v1/messages`, plus the three shapes that still answer. `ClientShapes` passes as a whole.

En el sitio

Enlaces a install, modelos, releases.