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 marvin | |
from marvin import ai_fn | |
marvin.settings.llm_model = 'gpt-4' | |
@ai_fn | |
def semantic_deduplication(new_item: str, existing_items: list[str]) -> list[str]: | |
""" | |
Check if the `new_item` is semantically the same as any of the `existing_items`. | |
If it is, update the existing item's description with the new one. |
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
from marvin import ai_fn | |
import pydantic | |
class EmailDetails(pydantic.BaseModel): | |
is_positive: bool = pydantic.Field( | |
description="Whether the email has a positive tone" | |
) | |
action_items: list[str] = pydantic.Field( | |
"Follow-up questions, rewritten as single sentences that are understandable" |
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
from marvin import ai_fn | |
@ai_fn | |
def generate_people(n: int) -> list[dict]: | |
"""Generates a list of n people with random names and ages.""" | |
generate_people(n=2) # [{'name': 'Olivia', 'age': 30}, {'name': 'Ethan', 'age': 22}] | |
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
from prefect import task, Flow, Parameter | |
from prefect.tasks.control_flow import case | |
@task | |
def send_email(email): | |
print(f"Sending an email to {email}") | |
@task |
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
Hey all, | |
As some of you already know, we're in the process of moving Airflow into the Apache incubator. This will involve a number of infrastructure and process changes. These changes will include: | |
1) Migration of airbnb/airflow code base to Apache's Git repository. | |
2) Migration of Google groups mailing list (this list) to Apache developer list. | |
3) Migration of Travis CI to use the Apache Git repository. | |
4) Migration of GitHub wiki to Apache Confluence wiki. | |
5) Migration of GitHub Issues to Apache Jira. | |
6) Migration of all existing pull requests to the Apache GitHub account. |
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 numpy as np | |
import theano | |
import theano.tensor as tt | |
# this is the input | |
inp = np.arange(10).reshape(-1,1) | |
print 'this is the input: {}'.format(inp) | |
# this is the expected output | |
exp_out = np.zeros((10,1)); exp_out[4:] = inp[:-4] |
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
library(ggplot2) | |
#extract reference data | |
mapcounties <- map_data("county") | |
mapstates <- map_data("state") | |
#merge data with ggplot county coordinates | |
mapcounties$county <- with(mapcounties , paste(region, subregion, sep = ",")) | |
mergedata <- merge(mapcounties, unemp_data, by.x = "county", by.y = "counties") | |
mergedata <- mergedata[order(mergedata$order),] |
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
library(maps) | |
#align data with map definitions | |
mapnames <- map("county",plot=FALSE)[4]$names | |
colorsmatched <- unemp_data$colorBuckets [match(mapnames ,unemp_data$counties)] | |
#draw map | |
map("county",col = colors[unemp_data$colorBuckets[match(mapnames ,unemp_data$counties)]],fill = TRUE,resolution = 0,lty = 0,projection = "polyconic") | |
map("state",col = "white",fill=FALSE,add=TRUE,lty=1,lwd=1,projection="polyconic") |
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
#load data | |
stateAbbr <- read.csv("state abbr.csv") | |
rownames(stateAbbr) <- stateAbbr$ABB | |
unemp_data <- read.csv("unemp_county.csv") | |
#get county names in correct format | |
countyNames <- sapply(as.character(unemp_data$CountyName),strsplit,", ") | |
counties <- sapply(countyNames ,"[",1) | |
states <- sapply(countyNames ,"[",2) | |
states <- as.character(stateAbbr[states,2]) |