This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import urllib2 | |
import json | |
# Set the endpoint URL and the prompt text | |
url = "https://api.openai.com/v1/completions" | |
# Set the API key and other parameters | |
data = json.dumps({ "model": "text-davinci-003", "prompt": prompt, "temperature": 0.5, "max_tokens": 1024}) | |
headers = { "Content-Type": "application/json", "Authorization": "Bearer {0}".format(api_key) } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// GWLlosa's answer in http://stackoverflow.com/questions/521687/c-sharp-foreach-with-index | |
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
namespace EnumerateTest { | |
class Program { | |
static void Main(string[] args) { | |
List<int> list = new List<int> {4, 2, 3, 1, 8}; |