Skip to content

Commit

Permalink
feat: Add stream information to generate SDKs (#1569)
Browse files Browse the repository at this point in the history
  • Loading branch information
imartinez authored Feb 2, 2024
1 parent 3e67e21 commit 24fae66
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
18 changes: 18 additions & 0 deletions fern/openapi/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,15 @@
}
}
}
},
"x-fern-streaming": {
"stream-condition": "stream",
"response": {
"$ref": "#/components/schemas/OpenAICompletion"
},
"response-stream": {
"$ref": "#/components/schemas/OpenAICompletion"
}
}
}
},
Expand Down Expand Up @@ -86,6 +95,15 @@
}
}
}
},
"x-fern-streaming": {
"stream-condition": "stream",
"response": {
"$ref": "#/components/schemas/OpenAICompletion"
},
"response-stream": {
"$ref": "#/components/schemas/OpenAICompletion"
}
}
}
},
Expand Down
7 changes: 7 additions & 0 deletions private_gpt/server/chat/chat_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,13 @@ class ChatBody(BaseModel):
response_model=None,
responses={200: {"model": OpenAICompletion}},
tags=["Contextual Completions"],
openapi_extra={
"x-fern-streaming": {
"stream-condition": "stream",
"response": {"$ref": "#/components/schemas/OpenAICompletion"},
"response-stream": {"$ref": "#/components/schemas/OpenAICompletion"},
}
},
)
def chat_completion(
request: Request, body: ChatBody
Expand Down
7 changes: 7 additions & 0 deletions private_gpt/server/completions/completions_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@ class CompletionsBody(BaseModel):
summary="Completion",
responses={200: {"model": OpenAICompletion}},
tags=["Contextual Completions"],
openapi_extra={
"x-fern-streaming": {
"stream-condition": "stream",
"response": {"$ref": "#/components/schemas/OpenAICompletion"},
"response-stream": {"$ref": "#/components/schemas/OpenAICompletion"},
}
},
)
def prompt_completion(
request: Request, body: CompletionsBody
Expand Down

0 comments on commit 24fae66

Please sign in to comment.