Skip to content

Commit

Permalink
Azure OpenAI: 2024-07-01-preview TypeSpec project updates (Azure#29785)
Browse files Browse the repository at this point in the history
* (incomplete) some initial definitions

* chunking strategy + examples

* examples

* readme+fixing examples

* file examples for inference

* different model for request/response

* Fixing inference readme + bing search tool

* format

* updated the batches routes

* no warnings for batches!

* added batch examples

* [OpenAI] `v2024_07_01_preview` service release remaining points (Azure#29967)

* TSP changes

* Compilation related swagger gen

* Removed unused comment section

* post-merge: format/compile and address example JSON warnings

* prettier, spellcheck, example fixes

* npx tsp format **/*tsp

* more example and validation fixes

* one more fix

* Added mismatched code block marker

* Commented out service team entry in the readme

* remove deferred parallel_tool_calls

* defer 'browser' tool to future version (removing it)

* Uncommented entry for service release

* Recompiled project

* Adding the only method that works

* Adding model to be emitted in the custom model subpackage

* Updated useDependency version for client and removed nullability from constant

* Added compiler warning supressions

* format fixes for assistants

* Using OpenAIPageableListOf type as in assistants

* remove stream_options

* TSP validtion check

* Update specification/cognitiveservices/OpenAI.Inference/routes/batches.tsp

Verified against service spec and OpenAI spec

Co-authored-by: Shawn Fang <45607042+mssfang@users.noreply.github.com>

* make license optional

* Adding missing documentation to query params in get batches list

* Made page of data fields optional

* Project compile

* Added request object for batches as full model instead of spreading it

* Reverted statusCode 201 change for batches create op

* Example fix and statusCode correct swagger gen

* Reformat

* reformat

---------

Co-authored-by: Gerardo Lecaros <10088504+glecaros@users.noreply.github.com>
Co-authored-by: Chris Schraer <chris_schraer@users.noreply.github.com>
Co-authored-by: Jose Alvarez <jpalvarezl@users.noreply.github.com>
Co-authored-by: Jose Alvarez <jp.alvarezl@gmail.com>
Co-authored-by: Jose Alvarez <josealvar@microsoft.com>
Co-authored-by: Shawn Fang <45607042+mssfang@users.noreply.github.com>
Co-authored-by: Minh-Anh Phan <111523473+minhanh-phan@users.noreply.github.com>
  • Loading branch information
8 people authored Aug 20, 2024
1 parent 0e24997 commit cd41ba3
Show file tree
Hide file tree
Showing 150 changed files with 18,282 additions and 356 deletions.
2 changes: 1 addition & 1 deletion specification/ai/OpenAI.Assistants/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ title: OpenAIAssistants
clear-output-folder: false
guessResourceKey: true
isAzureSpec: true
namespace: azure.ai.openai.assistants
namespace: azure.ai.openai.assistants
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"title": "Cancels a run that is `in_progress`.\n",
"parameters": {
"endpoint": "{endpoint}",
"api-version": "2024-07-01-preview",
"threadId": "thread_abc123",
"runId": "run_abc123"
},
"responses": {
"200": {
"body": {
"id": "run_abc123",
"object": "thread.run",
"created_at": 1699076126,
"assistant_id": "asst_abc123",
"thread_id": "thread_abc123",
"status": "cancelling",
"started_at": 1699076126,
"expires_at": 1699076726,
"cancelled_at": null,
"failed_at": null,
"completed_at": null,
"last_error": null,
"model": "gpt-4-turbo",
"instructions": "You summarize books.",
"tools": [
{
"type": "file_search"
}
],
"tool_choice": "auto",
"truncation_strategy": {
"type": "auto",
"last_messages": null
},
"max_completion_tokens": 1000,
"max_prompt_tokens": 1000,
"incomplete_details": null,
"metadata": {},
"usage": null,
"temperature": 1.0,
"top_p": 1.0,
"response_format": "auto"
}
}
},
"operationId": "CancelRun"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"title": "Cancel a vector store file batch. This attempts to cancel the processing of files in this batch as soon as possible.",
"parameters": {
"endpoint": "{endpoint}",
"api-version": "2024-07-01-preview",
"vectorStoreId": "vs_abc123",
"batchId": "vsfb_abc123"
},
"responses": {
"200": {
"body": {
"id": "vsfb_abc123",
"object": "vector_store.files_batch",
"created_at": 1699061776,
"vector_store_id": "vs_abc123",
"status": "cancelling",
"file_counts": {
"in_progress": 12,
"completed": 3,
"failed": 0,
"cancelled": 0,
"total": 15
}
}
}
},
"operationId": "CancelVectorStoreFileBatch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"title": "Create an assistant with a model and instructions.",
"parameters": {
"endpoint": "{endpoint}",
"api-version": "2024-07-01-preview",
"body": {
"name": "Math Tutor",
"instructions": "When a customer asks about a specific math problem, use Python to evaluate their query.",
"tools": [
{
"type": "code_interpreter"
}
],
"model": "gpt-4-1106-preview"
}
},
"responses": {
"200": {
"body": {
"id": "asst_4nsG2qgNzimRPE7MazXTXbU7",
"object": "assistant",
"created_at": 1707295707,
"name": "Math Tutor",
"description": null,
"model": "gpt-4-1106-preview",
"instructions": "When a customer asks about a specific math problem, use Python to evaluate their query.",
"tools": [
{
"type": "code_interpreter"
}
],
"tool_resources": {},
"metadata": {},
"top_p": 1.0,
"temperature": 1.0,
"response_format": "auto"
}
}
},
"operationId": "CreateAssistant"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"title": "Create a message.",
"parameters": {
"endpoint": "{endpoint}",
"api-version": "2024-07-01-preview",
"threadId": "thread_v7V4csrNOxtNmgcwGg496Smx",
"body": {
"role": "user",
"content": "What is the cube root of the sum of 12, 14, 1234, 4321, 90000, 123213541223, 443123123124, 5423324234, 234324324234, 653434534545, 200000000, 98237432984, 99999999, 99999999999, 220000000000, 3309587702? Give me the answer rounded to the nearest integer without commas or spaces."
}
},
"responses": {
"200": {
"body": {
"id": "msg_as3XIk1tpVP3hdHjWBGg3uG4",
"object": "thread.message",
"created_at": 1707298421,
"assistant_id": null,
"thread_id": "thread_v7V4csrNOxtNmgcwGg496Smx",
"run_id": null,
"role": "user",
"content": [
{
"type": "text",
"text": {
"value": "What is the cube root of the sum of 12, 14, 1234, 4321, 90000, 123213541223, 443123123124, 5423324234, 234324324234, 653434534545, 200000000, 98237432984, 99999999, 99999999999, 220000000000, 3309587702? Give me the answer rounded to the nearest integer without commas or spaces.",
"annotations": []
}
}
],
"status": "completed",
"incomplete_details": null,
"incomplete_at": null,
"completed_at": 1707298439,
"attachments": [],
"metadata": {}
}
}
},
"operationId": "CreateMessage"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"title": "Create a run.",
"parameters": {
"endpoint": "{endpoint}",
"api-version": "2024-07-01-preview",
"threadId": "thread_abc123",
"body": {
"assistant_id": "asst_abc123"
}
},
"responses": {
"200": {
"body": {
"id": "run_abc123",
"object": "thread.run",
"created_at": 1699063290,
"assistant_id": "asst_abc123",
"thread_id": "thread_abc123",
"status": "queued",
"started_at": 1699063290,
"expires_at": null,
"cancelled_at": null,
"failed_at": null,
"completed_at": 1699063291,
"last_error": null,
"model": "gpt-4-turbo",
"instructions": "",
"incomplete_details": null,
"tools": [
{
"type": "code_interpreter"
}
],
"metadata": {},
"usage": null,
"temperature": 1.0,
"top_p": 1.0,
"max_prompt_tokens": 1000,
"max_completion_tokens": 1000,
"truncation_strategy": {
"type": "auto",
"last_messages": null
},
"response_format": "auto",
"tool_choice": "auto"
}
}
},
"operationId": "CreateRun"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"title": "Creates a thread.",
"parameters": {
"endpoint": "{endpoint}",
"api-version": "2024-07-01-preview",
"body": {}
},
"responses": {
"200": {
"body": {
"id": "thread_v7V4csrNOxtNmgcwGg496Smx",
"object": "thread",
"created_at": 1707297136,
"tool_resources": {},
"metadata": {}
}
}
},
"operationId": "CreateThread"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"title": "Create a thread and run it in one request.",
"parameters": {
"endpoint": "{endpoint}",
"api-version": "2024-07-01-preview",
"body": {
"assistant_id": "asst_abc123",
"thread": {
"messages": [
{
"role": "user",
"content": "Explain deep learning to a 5 year old."
}
]
}
}
},
"responses": {
"200": {
"body": {
"id": "run_abc123",
"object": "thread.run",
"created_at": 1699076792,
"assistant_id": "asst_abc123",
"thread_id": "thread_abc123",
"status": "queued",
"started_at": null,
"expires_at": 1699077392,
"cancelled_at": null,
"failed_at": null,
"completed_at": null,
"required_action": null,
"last_error": null,
"model": "gpt-4-turbo",
"instructions": "You are a helpful assistant.",
"tools": [],
"metadata": {},
"temperature": 1.0,
"top_p": 1.0,
"max_completion_tokens": null,
"max_prompt_tokens": null,
"truncation_strategy": {
"type": "auto",
"last_messages": null
},
"incomplete_details": null,
"usage": null,
"response_format": "auto",
"tool_choice": "auto"
}
}
},
"operationId": "CreateThreadAndRun"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"title": "Creates a vector store.",
"parameters": {
"endpoint": "{endpoint}",
"api-version": "2024-07-01-preview",
"body": {
"name": "Support FAQ"
}
},
"responses": {
"200": {
"body": {
"id": "vs_abc123",
"object": "vector_store",
"created_at": 1699061776,
"name": "Support FAQ",
"usage_bytes": 139920,
"status": "completed",
"last_active_at": 1699061776,
"metadata": {},
"file_counts": {
"in_progress": 0,
"completed": 3,
"failed": 0,
"cancelled": 0,
"total": 3
}
}
}
},
"operationId": "CreateVectorStore"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"title": "Create a vector store file by attaching a File to a vector store.",
"parameters": {
"endpoint": "{endpoint}",
"api-version": "2024-07-01-preview",
"vectorStoreId": "vs_abc123",
"body": {
"file_id": "file-abc123"
}
},
"responses": {
"200": {
"body": {
"id": "file-abc123",
"object": "vector_store.file",
"created_at": 1699061776,
"usage_bytes": 1234,
"vector_store_id": "vs_abcd",
"status": "completed",
"last_error": null,
"chunking_strategy": {
"type": "other"
}
}
}
},
"operationId": "CreateVectorStoreFile"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"title": "Create a vector store file batch.",
"parameters": {
"endpoint": "{endpoint}",
"api-version": "2024-07-01-preview",
"vectorStoreId": "vs_abc123",
"body": {
"file_ids": [
"file-abc123",
"file-abc456"
]
}
},
"responses": {
"200": {
"body": {
"id": "vsfb_abc123",
"object": "vector_store.files_batch",
"created_at": 1699061776,
"vector_store_id": "vs_abc123",
"status": "in_progress",
"file_counts": {
"in_progress": 1,
"completed": 1,
"failed": 0,
"cancelled": 0,
"total": 0
}
}
}
},
"operationId": "CreateVectorStoreFileBatch"
}
Loading

0 comments on commit cd41ba3

Please sign in to comment.