Skip to content

Commit

Permalink
🧹
Browse files Browse the repository at this point in the history
  • Loading branch information
cboettig committed Jan 7, 2025
1 parent 179db2b commit 1ec6b81
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions test.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,27 @@ schema <- read_file("schema.yml")
system_prompt <- glue::glue(readr::read_file("system-prompt.md"),
.open = "<", .close = ">")



# Or optionally test with cirrus
chat <- ellmer::chat_vllm(
base_url = "https://llm.nrp-nautilus.io/",
model = "llama3",
api_key = Sys.getenv("NRP_API_KEY"),
base_url = "https://llm.cirrus.carlboettiger.info/v1/",
model = "kosbu/Llama-3.3-70B-Instruct-AWQ",
api_key = Sys.getenv("CIRRUS_LLM_KEY"),
system_prompt = system_prompt,
api_args = list(temperature = 0)
)

# or use the NRP model
chat <- ellmer::chat_vllm(
base_url = "https://llm.cirrus.carlboettiger.info/v1/",
model = "kosbu/Llama-3.3-70B-Instruct-AWQ",
api_key = Sys.getenv("CIRRUS_LLM_KEY"),
base_url = "https://llm.nrp-nautilus.io/",
model = "llama3",
api_key = Sys.getenv("NRP_API_KEY"),
system_prompt = system_prompt,
api_args = list(temperature = 0)
)


# Test a chat-based response
chat$chat("Which columns describes racial components of social vulnerability?")
## A query-based response
Expand All @@ -39,13 +44,6 @@ response <- jsonlite::fromJSON(stream)

con <- duckdbfs::cached_connection()
filtered_data <- DBI::dbGetQuery(con, response$query)
full_data <- svi
response_query <- "
SELECT COUNTY, AVG(RPL_THEME1) as avg_soc_vuln FROM
svi WHERE STATE = 'California' GROUP BY COUNTY ORDER BY
avg_soc_vuln DESC LIMIT 10;
"


filter_column <- function(full_data, filtered_data, id_col) {
if (nrow(filtered_data) < 1) return(NULL)
Expand Down

0 comments on commit 1ec6b81

Please sign in to comment.