Created
July 19, 2023 15:40
-
-
Save morganmcg1/72c1699d60598ee0eceacbc9230fb1e7 to your computer and use it in GitHub Desktop.
This file contains 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 openai | |
import wandb | |
openai.api_key = "sk-..." # supply your API key however you choose | |
# https://platform.openai.com/docs/models | |
tbl = wandb.Table("my_table", columns=["input", "output", "temperature"]) | |
query = "hello world" | |
systemp_prompts = "you are friendly" | |
completion = openai.ChatCompletion.create( | |
model="gpt-4", | |
temperature=0.7, | |
messages=[ | |
{"role": "system", "content": system_prompts} | |
{"role": "user", "content": query} | |
# {"role": "assistant", "content": "hello"} | |
] | |
) | |
output = completion.choices[0].message.content # extract token counts from "completion" | |
tbl.add_data(query, output, temperature) | |
wandb.log({"tbl": tbl}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment