Open AI Completion avatar
Open AI Completion
Deprecated
View all Actors
This Actor is deprecated

This Actor is unavailable because the developer has decided to deprecate it. Would you like to try a similar Actor instead?

See alternative Actors
Open AI Completion

Open AI Completion

tkapler/openai-completion-actor

Provides a simple but powerful text-in, text-out interface to any OpenAI models. 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. https://beta.openai.com/docs/guides/completion

Open AI Completion Actor

This Apify Actor use Open AI beta and its Completions Guide to provide advance AI answers to your prompts using GPT-3 and Codex models.

*You must recieve the Open AI beta access / API key. Join the waitlist if you do not have it yet (it can take few weeks)

Input properties

There are 2 key input properties

Details about the other properties you can find under the (?) help icon, in INPUT_SCHEMA.json and in Open AI Codex Reference.

Example prompt

You can type almost anything, good examples can be found in Open AI examples section, e.g.

Grammar correction - Davinci GPT-3

link This zero-shot prompt corrects sentences into standard English.

Prompt

1Original: She no went to the market.
2Standard American English:

Sample response

She didn't go to the market.

Explain code - Davinci Codex

link Explain a complicated piece of code.

Prompt

1class Log:
2    def __init__(self, path):
3        dirname = os.path.dirname(path)
4        os.makedirs(dirname, exist_ok=True)
5        f = open(path, "a+")
6
7        # Check that the file is newline-terminated
8        size = os.path.getsize(path)
9        if size > 0:
10            f.seek(size - 1)
11            end = f.read(1)
12            if end != "\n":
13                f.write("\n")
14        self.f = f
15        self.path = path
16
17    def log(self, event):
18        event["_event_id"] = str(uuid.uuid4())
19        json.dump(event, self.f)
20        self.f.write("\n")
21
22    def state(self):
23        state = {"complete": set(), "last": None}
24        for line in open(self.path):
25            event = json.loads(line)
26            if event["type"] == "submit" and event["success"]:
27                state["complete"].add(event["id"])
28                state["last"] = event
29        return state
30
31"""
32Here's what the above class is doing:

Sample response

11. Create a directory for the log file if it doesn't exist.
22. Open the log file in append mode.
33. Check that the file is newline-terminated. If it isn't, add a newline.
44. Create a state dictionary with two keys:
5    - complete: a set of all completed job IDs
6    - last: the last event in the log file
75. Return the state dictionary.
Developer
Maintained by Community