dhe128
dhe128
Explore posts from servers
RRunPod
Created by dhe128 on 10/30/2024 in #⚡|serverless
How to get `/stream` serverless endpoint to "stream"?
Example from official documentation: https://docs.runpod.io/sdks/javascript/endpoints#stream
from time import sleep
import runpod


def handler(job):
job_input = job["input"]["prompt"]

for i in job_input:
sleep(1) # sleep for 1 second for effect
yield i


runpod.serverless.start(
{
"handler": handler,
"return_aggregate_stream": True, # Ensures aggregated results are streamed back
}
)
from time import sleep
import runpod


def handler(job):
job_input = job["input"]["prompt"]

for i in job_input:
sleep(1) # sleep for 1 second for effect
yield i


runpod.serverless.start(
{
"handler": handler,
"return_aggregate_stream": True, # Ensures aggregated results are streamed back
}
)
import runpodSdk from "runpod-sdk";

async function main() {
const runpod = runpodSdk(RUNPOD_API_KEY);
const endpoint = runpod.endpoint(ENDPOINT_ID);
const result = await endpoint.run({
input: {
prompt: "Hello, World!",
},
});

console.log(result);

const { id } = result;
for await (const result of endpoint.stream(id)) {
console.log(`${JSON.stringify(result, null, 2)}`);
}
console.log("done streaming");
}
import runpodSdk from "runpod-sdk";

async function main() {
const runpod = runpodSdk(RUNPOD_API_KEY);
const endpoint = runpod.endpoint(ENDPOINT_ID);
const result = await endpoint.run({
input: {
prompt: "Hello, World!",
},
});

console.log(result);

const { id } = result;
for await (const result of endpoint.stream(id)) {
console.log(`${JSON.stringify(result, null, 2)}`);
}
console.log("done streaming");
}
The example suggests that the /stream endpoint should return the entire input, one letter at a time. However, when I try it it only sends the first letter back, followed by the http connection closing. Is /stream intended to be streamed from start to finish, or polled repeatedly?
9 replies
PPrisma
Created by dhe128 on 10/29/2024 in #help-and-questions
prisma migrate diff freezes
pnpm prisma migrate diff --from-migrations=migrations --to-schema-datamodel=schema.prisma --shadow-databa se-url=$DB_URL Running the above command shows no output for over 2 minutes. How can I know if it's doing something or just stuck? Is there a verbose option to see which db commands it's attempting?
3 replies
PPrisma
Created by dhe128 on 10/16/2024 in #help-and-questions
How to line wrap prisma cli output?
No description
2 replies
PPrisma
Created by dhe128 on 8/24/2024 in #help-and-questions
Error: P3005 The database schema is not empty.
I want to initialize prisma in an existing supabase project. All schemas in datasource db.schemas are empty, and public._prisma_migrations does not exist. I have the initial migration in migrations/0_init/migration.sql, generated via https://www.prisma.io/docs/orm/prisma-migrate/workflows/baselining I'm getting Error: P3005 The database schema is not empty. with either prisma migrate dev and prisma migrate deploy. In addition prisma migrate reset also has the same error. How do I get the db into a state where I can deploy the initial migration?
9 replies