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
/** | |
* @customfunction | |
*/ | |
async function completion(content: string) { | |
const response = await fetch("https://api.openai.com/v1/chat/completions", { | |
method: "POST", | |
headers: { | |
"Content-Type": "application/json", | |
"Authorization": "Bearer <OPENAI_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
import openai | |
import re | |
system_prompt = """ | |
Why does my music player only shuffle songs by the same artist even when I select the "shuffle all" option? | |
take a deep breath and explain your thoughts in a <thoughts> tag shortly. Then, answer the question. | |
""" | |
response = openai.chat.completions.create( |
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 pandas as pd | |
from sklearn.metrics import accuracy_score | |
data = pd.read_csv("data.csv") | |
print(accuracy_score(data["actual"], data["sentiment"])) |
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
@metric("median") | |
def median_metric(data: DataFrame) -> Optional[Union[float, int]]: | |
"""Computes the median of a data series. | |
Args: | |
data: Data series. | |
Returns: | |
DataFrame median value or None if DataFrame is empty. | |
""" | |
series = df_to_series(data) | |
if len(series) == 0: |
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 fetch from "node-fetch"; | |
const APORIA_TOKEN = "<TOKEN>"; | |
async function logPredictions(data) { | |
const query = ` | |
mutation LogPredict( | |
$modelId: String!, | |
$modelVersion: String!, | |
$environment: String!, |
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
curl --request POST \ | |
--url <APORIA_HOST>/v1/tenant-hasura/v1/graphql \ | |
--header 'Authorization: Bearer <TOKEN>' \ | |
--header 'Content-Type: application/json' \ | |
--data \ | |
'{ | |
"query": "query { models { id name versions { id name } } }", | |
"variables": {} | |
}' |
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
FROM python:3.8-slim | |
WORKDIR /my_model | |
STOPSIGNAL SIGINT | |
ENV LISTEN_PORT 80 | |
# System dependencies | |
RUN apt update && apt install -y libgomp1 | |
RUN pip3 install poetry |
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
sepal.length | sepal.width | petal.length | petal.width | variety | |
---|---|---|---|---|---|
5.1 | 3.5 | 1.4 | .2 | Setosa | |
4.9 | 3 | 1.4 | .2 | Setosa | |
4.7 | 3.2 | 1.3 | .2 | Setosa | |
4.6 | 3.1 | 1.5 | .2 | Setosa | |
5 | 3.6 | 1.4 | .2 | Setosa | |
5.4 | 3.9 | 1.7 | .4 | Setosa | |
4.6 | 3.4 | 1.4 | .3 | Setosa | |
5 | 3.4 | 1.5 | .2 | Setosa | |
4.4 | 2.9 | 1.4 | .2 | Setosa |
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 * as pulumi from '@pulumi/pulumi'; | |
import * as k8s from '@pulumi/kubernetes'; | |
export interface TraefikRouteArgs { | |
namespace: pulumi.Input<string>; | |
prefix: pulumi.Input<string>; | |
service: pulumi.Input<k8s.core.v1.Service>; | |
} | |
export default class TraefikRoute extends pulumi.ComponentResource { |
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 * as pulumi from '@pulumi/pulumi'; | |
import * as aws from '@pulumi/aws'; | |
import * as k8s from '@pulumi/kubernetes'; | |
export interface S3ServiceAccountArgs { | |
oidcProvider: aws.iam.OpenIdConnectProvider; | |
namespace: pulumi.Input<string>; | |
readOnly: pulumi.Input<boolean>; | |
} |
NewerOlder