Closed simonw closed 8 months ago
Full list of models: https://docs.endpoints.anyscale.com/category/supported-models
I tried Meta-Llama/Llama-Guard-7b
but got this error:
endpoints llm -m Meta-Llama/Llama-Guard-7b hello
Error: rayllm.common.models.PromptFormatDisabledError: This model doesn't support chat completions. Please use the completions endpoint instead. (Request ID: TImvQaY61Ge0wkfMmPV56zDPFJh1_pUHjBJI9_0UYOU)
Mixtral really is very good:
llm -m mistralai/Mixtral-8x7B-Instruct-v0.1 \
'Write a Python function that accepts a URL to a CSV file, downloads it and loads it into a SQLite database, creating a table with the correct columns'
Here's a Python function that accomplishes the task you described, using the requests, csv, sqlite3, and io libraries:
import requests import csv import sqlite3 from io import StringIO def download_csv_to_sqlite(url): # Download the CSV file from the URL response = requests.get(url) response.raise_for_status() # Load the CSV data into a StringIO buffer csv_buffer = StringIO(response.text) # Connect to a new SQLite database in memory conn = sqlite3.connect(":memory:") # Create a new cursor for executing SQL commands cursor = conn.cursor() # Read the first row of the CSV file to determine the column names csv_reader = csv.reader(csv_buffer) columns = next(csv_reader) # Create a new table in the SQLite database with the correct columns column_defs = ", ".join([f"{col} TEXT" for col in columns]) cursor.execute(f"CREATE TABLE csv_table ({column_defs});") # Insert the remaining rows of the CSV file into the table for row in csv_reader: value_defs = ", ".join(["?" for _ in row]) cursor.execute(f"INSERT INTO csv_table VALUES ({value_defs});", row) # Commit the changes and close the connection conn.commit() conn.close() # Example usage url = "https://example.com/data.csv" download_csv_to_sqlite(url)
This function downloads the CSV file from the given URL, loads it into a SQLite database in memory, creates a new table with the correct columns, and inserts all the rows from the CSV file into the table.
Note that this function uses an in-memory SQLite database for simplicity, but you can modify it to use a persistent database file if needed. Also, the function assumes that the CSV file contains text data, but you can modify it to handle other data types as necessary.
https://app.endpoints.anyscale.com/explorer now lists:
I only have these currently:
https://github.com/simonw/llm-anyscale-endpoints/blob/86f395560530374da237092a500fa06b2022faeb/llm_anyscale_endpoints.py#L4-L10
Would be better if the plugin could retrieve the list from somewhere.