Skip to content

Latest commit

 

History

History

textcompletion

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Chat

This sample demonstrates how to build a text completion sample using Azure Functions and a local build of the Azure OpenAI extension.

The sample is available in the following language stacks:

Prerequisites

Please refer to the root level README for prerequisites.

Running the sample

  1. Start Azurite for local development storage. See these instructions for more information on how to work with Azurite.

  2. Reference the table below for instructions on building and starting the app:

    Language Worker Command
    .NET oo-proc cd samples/textcompletion/csharp-ooproc && dotnet build && cd bin/debug/net6.0 && func start
    Javacript cd samples/textcompletion/javascript && npm install && npm run start
    TypeScript cd samples/textcompletion/typescript && npm install && npm run build && npm run start
    PowerShell cd samples/textcompletion/powershell && dotnet build --output bin && func start
    Python cd samples/textcompletion/python && pip install -r requirements.txt && func start
    Java cd samples/textcompletion/java && mvn clean package && dotnet build && mvn azure-functions:run

    If successful, you should see the following output from the func command:

    Azure Functions Core Tools
    Core Tools Version:       4.0.5530 Commit hash: N/A  (64-bit)
    Function Runtime Version: 4.28.5.21962
    
    Functions:
    
        GenericCompletion: [POST] http://localhost:7071/api/GenericCompletion
    
        WhoIs: [GET] http://localhost:7071/api/whois/{name}
    

Running the "who is" Text Completion sample

  1. Refer the demo.http file for the format of requests.
  2. Send a request to the WhoIs function. The following is an example request:
GET http://localhost:7071/api/whois/pikachu

The HTTP response should look something like the following example (with newlines added for readability):

Pikachu is a fictional creature from the Pokemon franchise. It is a yellow
mouse-like creature with powerful electrical abilities and a mischievous
personality. Pikachu is one of the most iconic and recognizable characters
from the franchise, and is featured in numerous video games, anime series,
movies, and other media.