Using retrieval through completion api

For our application steamed results is absolutile critical and given that the
assistanrt api does not support streamed result I am wondering if it is possible to use the data retrieval features of the assitant api using the completion api.

I have looked at the messages and used some of the extra data in the completion api.

It accepts “tools”: [
{
“type”: “retrieval”
},

but reject
“file_ids”: [
“file-f8HCyhukPNvoRSC5rpqKMy83”
],

Is there away of doing this using the completion api.

To me it would seem seem likely as the assitant api seems to be an abstract layer over completeion but I can’t find any examples or documentation for doing this.

Any assitance greatly appreciated

One way is to make an Assistant with Retrieval and put it in an endpoint or just directly call it from the Chat Completions API, with streaming = true, when a function calling is triggered.

    flowchart
         assistants -->models
         assistants-->ic[code interpreter]
         assistants -->functions
 assistants -->retrieval
assistants-->storage
assistants-->threads
API-->models
API-->assistants

you’d need to go through assistants to get your retrievals :frowning:

but doing it yourself isn’t that complicated. and it’s not really expensive either!

2 Likes