Skip to content

Commit 156f5b0

Browse files
committed
Merge branch 'main' of https://github.com/MicrosoftDocs/azure-docs-pr into WI61565-deprecation
2 parents 66b73c5 + 28bc893 commit 156f5b0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+1616
-300
lines changed

articles/applied-ai-services/form-recognizer/whats-new.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ Form Recognizer service is updated on an ongoing basis. Bookmark this page to st
6060

6161
The **prebuilt ID document model** now has added support for the following document types:
6262

63-
* Passport, driver's license, and residence permit ID expansion.
63+
* Passport, driver's license, and residence permit ID expansion
6464
* US military ID cards and documents
6565
* India ID cards and documents
6666
* Australia ID cards and documents

articles/azure-resource-manager/management/azure-subscription-service-limits.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,18 @@ To learn more about limits on a more granular level, such as document size, quer
105105

106106
[!INCLUDE [azure-cognitive-services-limits](../../../includes/azure-cognitive-services-limits.md)]
107107

108+
## Azure Communications Gateway limits
109+
110+
Some of the following default limits and quotas can be increased. To request a change, create a [change request](/azure/communications-gateway/request-changes.md) stating the limit you want to change.
111+
112+
[!INCLUDE [communications-gateway-general-restrictions](../../communications-gateway/includes/communications-gateway-general-restrictions.md)]
113+
114+
Azure Communications Gateway also has limits on the SIP signaling.
115+
116+
[!INCLUDE [communications-gateway-sip-size-restrictions](../../communications-gateway/includes/communications-gateway-sip-size-restrictions.md)]
117+
118+
[!INCLUDE [communications-gateway-sip-behavior-restrictions](../../communications-gateway/includes/communications-gateway-sip-behavior-restrictions.md)]
119+
108120
## Azure Container Apps limits
109121

110122
For Azure Container Apps limits, see [Quotas in Azure Container Apps](../../container-apps/quotas.md).

articles/cognitive-services/openai/how-to/completions.md

Lines changed: 3 additions & 285 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ keywords:
1515

1616
---
1717

18-
# Learn how to generate or manipulate text, including code
18+
# Learn how to generate or manipulate text
1919

2020
The completions endpoint can be used for a wide variety of tasks. It provides a simple but powerful text-in, text-out interface to any of our [models](../concepts/models.md). You input some text as a prompt, and the model will generate a text completion that attempts to match whatever context or pattern you gave it. For example, if you give the API the prompt, "As Descartes said, I think, therefore", it will return the completion " I am" with high probability.
2121

@@ -352,295 +352,13 @@ A: Two, Phobos and Deimos.
352352
353353
Q:
354354
```
355-
356355
## Working with code
357356

358357
The Codex model series is a descendant of OpenAI's base GPT-3 series that's been trained on both natural language and billions of lines of code. It's most capable in Python and proficient in over a dozen languages including C#, JavaScript, Go, Perl, PHP, Ruby, Swift, TypeScript, SQL, and even Shell.
359358

360-
You can use Codex for a variety of tasks including:
361-
362-
* Turn comments into code
363-
* Complete your next line or function in context
364-
* Bring knowledge to you, such as finding a useful library or API call for an application
365-
* Add comments
366-
* Rewrite code for efficiency
367-
368-
369-
### Codex examples
370-
371-
Here are a few examples of using Codex
372-
373-
**Saying "Hello" (Python)**
374-
375-
```
376-
"""
377-
Ask the user for their name and say "Hello"
378-
"""
379-
```
380-
381-
**Create random names (Python)**
382-
383-
```
384-
"""
385-
1. Create a list of first names
386-
2. Create a list of last names
387-
3. Combine them randomly into a list of 100 full names
388-
"""
389-
```
390-
391-
**Create a MySQL query (Python)**
392-
393-
```
394-
"""
395-
Table customers, columns = [CustomerId, FirstName, LastName, Company, Address, City, State, Country, PostalCode, Phone, Fax, Email, SupportRepId]
396-
Create a MySQL query for all customers in Texas named Jane
397-
"""
398-
query =
399-
```
400-
401-
**Explaining code (JavaScript)**
402-
403-
```
404-
// Function 1
405-
var fullNames = [];
406-
for (var i = 0; i < 50; i++) {
407-
fullNames.push(names[Math.floor(Math.random() * names.length)]
408-
+ " " + lastNames[Math.floor(Math.random() * lastNames.length)]);
409-
}
410-
411-
// What does Function 1 do?
412-
```
413-
414-
### Best practices
415-
416-
**Start with a comment, data or code.** To get Codex to create a useful completion it's helpful to think about what information a programmer would need to perform a task. This could just be a clear comment or the data needed to write a useful function, like the names of variables or what class a function handles.
417-
418-
```
419-
# Create a function called 'nameImporter' to add a first and last name to the database
420-
```
421-
422-
In this example we tell Codex what to call the function and what task it's going to perform.
423-
424-
This approach scales even to the point where you can provide Codex with a comment and an example of a database schema to get it to write useful query requests for various databases.
425-
426-
```
427-
# Table albums, columns = [AlbumId, Title, ArtistId]
428-
# Table artists, columns = [ArtistId, Name]
429-
# Table media_types, columns = [MediaTypeId, Name]
430-
# Table playlists, columns = [PlaylistId, Name]
431-
# Table playlist_track, columns = [PlaylistId, TrackId]
432-
# Table tracks, columns = [TrackId, Name, AlbumId, MediaTypeId, GenreId, Composer, Milliseconds, Bytes, UnitPrice]
433-
434-
# Create a query for all albums by Adele
435-
```
436-
437-
When you show Codex the database schema it's able to make an informed guess about how to format a query.
438-
439-
**Specify the language.** Codex understands dozens of different programming languages. Many share similar conventions for comments, functions and other programming syntax. By specifying the language and what version in a comment, Codex is better able to provide a completion for what you want. That said, Codex is fairly flexible with style and syntax.
440-
441-
```
442-
# R language
443-
# Calculate the mean distance between an array of points
444-
```
445-
446-
```
447-
# Python 3
448-
# Calculate the mean distance between an array of points
449-
```
450-
451-
*Prompt Codex with what you want it to do.* If you want Codex to create a webpage, placing the first line of code in an HTML document (`<!DOCTYPE html>`) after your comment tells Codex what it should do next. The same method works for creating a function from a comment (following the comment with a new line starting with `func` or `def`).
452-
453-
```
454-
<!-- Create a web page with the title 'Kat Katman attorney at paw' -->
455-
<!DOCTYPE html>
456-
```
457-
458-
Placing `<!DOCTYPE html>` after our comment makes it very clear to Codex what we want it to do.
459-
460-
```
461-
# Create a function to count to 100
462-
463-
def counter
464-
```
465-
466-
If we start writing the function Codex will understand what it needs to do next.
467-
468-
**Specifying libraries will help Codex understand what you want.** Codex is aware of a large number of libraries, APIs and modules. By telling Codex which ones to use, either from a comment or importing them into your code, Codex will make suggestions based upon them instead of alternatives.
469-
470-
```
471-
<!-- Use A-Frame version 1.2.0 to create a 3D website -->
472-
<!-- https://aframe.io/releases/1.2.0/aframe.min.js -->
473-
```
474-
475-
By specifying the version, you can make sure Codex uses the most current library.
476-
477-
> [!NOTE]
478-
> Codex can suggest helpful libraries and APIs, but always be sure to do your own research to make sure that they're safe for your application.
479-
480-
**Comment style can affect code quality.** With some languages, the style of comments can improve the quality of the output. For example, when working with Python, in some cases using doc strings (comments wrapped in triple quotes) can give higher quality results than using the pound (#) symbol.
481-
482-
```
483-
"""
484-
Create an array of users and email addresses
485-
"""
486-
```
487-
488-
**Put comments inside of functions can be helpful.** Recommended coding standards suggest placing the description of a function inside the function. Using this format helps Codex more clearly understand what you want the function to do.
489-
490-
```
491-
def getUserBalance(id):
492-
"""
493-
Look up the user in the database ‘UserData' and return their current account balance.
494-
"""
495-
```
496-
497-
**Provide examples for more precise results.** If you have a particular style or format you need Codex to use, providing examples or demonstrating it in the first part of the request will help Codex more accurately match what you need.
498-
499-
```
500-
"""
501-
Create a list of random animals and species
502-
"""
503-
animals = [ {"name": "Chomper", "species": "Hamster"}, {"name":
504-
```
505-
506-
**Lower temperatures give more precise results.** Setting the API temperature to 0, or close to zero (such as 0.1 or 0.2) tends to give better results in most cases. Unlike GPT-3 models, where a higher temperature can provide useful creative and random results, higher temperatures with Codex models may give you really random or erratic responses.
507-
508-
In cases where you need Codex to provide different potential results, start at zero and then increment upwards by .1 until you find suitable variation.
509-
510-
**Organize tasks into functions.** We can get Codex to write functions by specifying what the function should do in as precise terms as possible in comment. By writing the following comment, Codex creates a JavaScript timer function that's triggered when a user presses a button:
511-
512-
A simple JavaScript timer
513-
514-
```
515-
// Create a timer that creates an alert in 10 seconds
516-
```
517-
518-
We can use Codex to perform common tasks with well known libraries like creating a customer with the Stripe API:
519-
520-
Create a Stripe customer in Python
521-
522-
```
523-
# Create a Stripe customer from an email address
524-
```
525-
526-
**Creating example data.** Testing applications often requires using example data. Because Codex is also a language model that understands how to comprehend and write natural language, you can ask Codex to create data like arrays of made up names, products and other variables.
527-
528-
```
529-
/* Create an array of weather temperatures for San Francisco */
530-
```
531-
532-
Asking Codex to perform this task will produce a table like this:
533-
534-
```
535-
var weather = [
536-
{ month: 'January', high: 58, low: 48 },
537-
{ month: 'February', high: 61, low: 50 },
538-
{ month: 'March', high: 64, low: 53 },
539-
{ month: 'April', high: 67, low: 55 },
540-
{ month: 'May', high: 70, low: 58 },
541-
{ month: 'June', high: 73, low: 61 },
542-
{ month: 'July', high: 76, low: 63 },
543-
{ month: 'August', high: 77, low: 64 },
544-
{ month: 'September', high: 76, low: 63 },
545-
{ month: 'October', high: 73, low: 61 },
546-
{ month: 'November', high: 68, low: 57 },
547-
{ month: 'December', high: 64, low: 54 }
548-
];
549-
```
550-
551-
**Compound functions and small applications.** We can provide Codex with a comment consisting of a complex request like creating a random name generator or performing tasks with user input and Codex can generate the rest provided there are enough tokens.
552-
553-
```
554-
/*
555-
Create a list animals
556-
Create a list of cities
557-
Use the lists to generate stories about what I saw at the zoo in each city
558-
*/
559-
```
560-
561-
**Use Codex to explain code.** Codex's ability to create and understand code allows us to use it to perform tasks like explaining what the code in a file does. One way to accomplish this is by putting a comment after a function that starts with "This function" or "This application is." Codex typically interprets this comment as the start of an explanation and completes the rest of the text.
562-
563-
```
564-
/* Explain what the previous function is doing: It
565-
```
566-
567-
**Explaining an SQL query.** In this example we use Codex to explain in a human readable format what an SQL query is doing.
568-
569-
```
570-
SELECT DISTINCT department.name
571-
FROM department
572-
JOIN employee ON department.id = employee.department_id
573-
JOIN salary_payments ON employee.id = salary_payments.employee_id
574-
WHERE salary_payments.date BETWEEN '2020-06-01' AND '2020-06-30'
575-
GROUP BY department.name
576-
HAVING COUNT(employee.id) > 10;
577-
-- Explanation of the above query in human readable format
578-
--
579-
```
580-
581-
**Writing unit tests.** Creating a unit test can be accomplished in Python simply by adding the comment "Unit test" and starting a function.
582-
583-
```
584-
# Python 3
585-
def sum_numbers(a, b):
586-
return a + b
587-
588-
# Unit test
589-
def
590-
```
591-
592-
**Checking code for errors.** By using examples, you can show Codex how to identify errors in code. In some cases no examples are required, however demonstrating the level and detail to provide a description can help Codex understand what to look for and how to explain it. (A check by Codex for errors shouldn't replace careful review by the user. )
593-
594-
```
595-
/* Explain why the previous function doesn't work. */
596-
```
597-
598-
**Using source data to write database functions.** Just as a human programmer would benefit from understanding the database structure and the column names, Codex can use this data to help you write accurate query requests. In this example we insert the schema for a database and tell Codex what to query the database for.
599-
600-
```
601-
# Table albums, columns = [AlbumId, Title, ArtistId]
602-
# Table artists, columns = [ArtistId, Name]
603-
# Table media_types, columns = [MediaTypeId, Name]
604-
# Table playlists, columns = [PlaylistId, Name]
605-
# Table playlist_track, columns = [PlaylistId, TrackId]
606-
# Table tracks, columns = [TrackId, Name, AlbumId, MediaTypeId, GenreId, Composer, Milliseconds, Bytes, UnitPrice]
607-
608-
# Create a query for all albums by Adele
609-
```
610-
611-
**Converting between languages.** You can get Codex to convert from one language to another by following a simple format where you list the language of the code you want to convert in a comment, followed by the code and then a comment with the language you want it translated into.
612-
613-
```
614-
# Convert this from Python to R
615-
# Python version
616-
617-
[ Python code ]
618-
619-
# End
620-
621-
# R version
622-
```
623-
624-
**Rewriting code for a library or framework.** If you want Codex to make a function more efficient, you can provide it with the code to rewrite followed by an instruction on what format to use.
625-
626-
```
627-
// Rewrite this as a React component
628-
var input = document.createElement('input');
629-
input.setAttribute('type', 'text');
630-
document.body.appendChild(input);
631-
var button = document.createElement('button');
632-
button.innerHTML = 'Say Hello';
633-
document.body.appendChild(button);
634-
button.onclick = function() {
635-
var name = input.value;
636-
var hello = document.createElement('div');
637-
hello.innerHTML = 'Hello ' + name;
638-
document.body.appendChild(hello);
639-
};
640-
641-
// React version:
642-
```
359+
Learn more about generating code completions, with the [working with code guide](./work-with-code.md)
643360

644361
## Next steps
645362

363+
Learn [how to work with code (Codex)](./work-with-code.md).
646364
Learn more about the [underlying models that power Azure OpenAI](../concepts/models.md).

0 commit comments

Comments
 (0)