mirror of
https://github.com/langflow-ai/langflow.git
synced 2026-07-24 10:07:42 +08:00
docs: cut version 1.9.0 (#12681)
* version-1.9.0-docs * [autofix.ci] apply automated fixes * [autofix.ci] apply automated fixes (attempt 2/3) --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
@ -0,0 +1,16 @@
|
||||
import OpenAI from "openai";
|
||||
|
||||
const client = new OpenAI({
|
||||
baseURL: "LANGFLOW_SERVER_URL/api/v1/",
|
||||
defaultHeaders: {
|
||||
"x-api-key": "LANGFLOW_API_KEY"
|
||||
},
|
||||
apiKey: "dummy-api-key" // Required by OpenAI SDK but not used by Langflow
|
||||
});
|
||||
|
||||
const response = await client.responses.create({
|
||||
model: "FLOW_ID",
|
||||
input: "There is an event that happens on the second wednesday of every month. What are the event dates in 2026?"
|
||||
});
|
||||
|
||||
console.log(response.output_text);
|
||||
@ -0,0 +1,24 @@
|
||||
const url = `http://${process.env.LANGFLOW_SERVER_URL ?? ""}/api/v1/responses`;
|
||||
|
||||
const options = {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
"x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
|
||||
"Content-Type": `application/json`,
|
||||
},
|
||||
body: JSON.stringify({
|
||||
"model": "ced2ec91-f325-4bf0-8754-f3198c2b1563",
|
||||
"input": "What's my name?",
|
||||
"previous_response_id": "c45f4ac8-772b-4675-8551-c560b1afd590"
|
||||
}),
|
||||
};
|
||||
|
||||
fetch(url, options)
|
||||
.then(async (response) => {
|
||||
if (!response.ok) {
|
||||
throw new Error(`HTTP ${response.status}`);
|
||||
}
|
||||
const text = await response.text();
|
||||
console.log(text);
|
||||
})
|
||||
.catch((error) => console.error(error));
|
||||
@ -0,0 +1,24 @@
|
||||
const url = `http://${process.env.LANGFLOW_SERVER_URL ?? ""}/api/v1/responses`;
|
||||
|
||||
const options = {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
"x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
|
||||
"Content-Type": `application/json`,
|
||||
},
|
||||
body: JSON.stringify({
|
||||
"model": "ced2ec91-f325-4bf0-8754-f3198c2b1563",
|
||||
"input": "What's my name?",
|
||||
"previous_response_id": "session-alice-1756839048"
|
||||
}),
|
||||
};
|
||||
|
||||
fetch(url, options)
|
||||
.then(async (response) => {
|
||||
if (!response.ok) {
|
||||
throw new Error(`HTTP ${response.status}`);
|
||||
}
|
||||
const text = await response.text();
|
||||
console.log(text);
|
||||
})
|
||||
.catch((error) => console.error(error));
|
||||
@ -0,0 +1,23 @@
|
||||
const url = `http://${process.env.LANGFLOW_SERVER_URL ?? ""}/api/v1/responses`;
|
||||
|
||||
const options = {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
"x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
|
||||
"Content-Type": `application/json`,
|
||||
},
|
||||
body: JSON.stringify({
|
||||
"model": "$FLOW_ID",
|
||||
"input": "Hello, my name is Alice"
|
||||
}),
|
||||
};
|
||||
|
||||
fetch(url, options)
|
||||
.then(async (response) => {
|
||||
if (!response.ok) {
|
||||
throw new Error(`HTTP ${response.status}`);
|
||||
}
|
||||
const text = await response.text();
|
||||
console.log(text);
|
||||
})
|
||||
.catch((error) => console.error(error));
|
||||
@ -0,0 +1,24 @@
|
||||
const url = `${process.env.LANGFLOW_SERVER_URL ?? ""}/api/v1/responses`;
|
||||
|
||||
const options = {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
"x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
|
||||
"Content-Type": `application/json`,
|
||||
},
|
||||
body: JSON.stringify({
|
||||
"model": "$YOUR_FLOW_ID",
|
||||
"input": "Hello, how are you?",
|
||||
"stream": false
|
||||
}),
|
||||
};
|
||||
|
||||
fetch(url, options)
|
||||
.then(async (response) => {
|
||||
if (!response.ok) {
|
||||
throw new Error(`HTTP ${response.status}`);
|
||||
}
|
||||
const text = await response.text();
|
||||
console.log(text);
|
||||
})
|
||||
.catch((error) => console.error(error));
|
||||
@ -0,0 +1,24 @@
|
||||
const url = `${process.env.LANGFLOW_SERVER_URL ?? ""}/api/v1/responses`;
|
||||
|
||||
const options = {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
"x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
|
||||
"Content-Type": `application/json`,
|
||||
},
|
||||
body: JSON.stringify({
|
||||
"model": "$FLOW_ID",
|
||||
"input": "Tell me a story about a robot",
|
||||
"stream": true
|
||||
}),
|
||||
};
|
||||
|
||||
fetch(url, options)
|
||||
.then(async (response) => {
|
||||
if (!response.ok) {
|
||||
throw new Error(`HTTP ${response.status}`);
|
||||
}
|
||||
const text = await response.text();
|
||||
console.log(text);
|
||||
})
|
||||
.catch((error) => console.error(error));
|
||||
@ -0,0 +1,26 @@
|
||||
const url = `${process.env.LANGFLOW_SERVER_URL ?? ""}/api/v1/responses`;
|
||||
|
||||
const options = {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
"x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
|
||||
"Content-Type": `application/json`,
|
||||
"X-LANGFLOW-GLOBAL-VAR-OPENAI_API_KEY": `sk-...`,
|
||||
"X-LANGFLOW-GLOBAL-VAR-USER_ID": `user123`,
|
||||
"X-LANGFLOW-GLOBAL-VAR-ENVIRONMENT": `production`,
|
||||
},
|
||||
body: JSON.stringify({
|
||||
"model": "your-flow-id",
|
||||
"input": "Hello"
|
||||
}),
|
||||
};
|
||||
|
||||
fetch(url, options)
|
||||
.then(async (response) => {
|
||||
if (!response.ok) {
|
||||
throw new Error(`HTTP ${response.status}`);
|
||||
}
|
||||
const text = await response.text();
|
||||
console.log(text);
|
||||
})
|
||||
.catch((error) => console.error(error));
|
||||
@ -0,0 +1,27 @@
|
||||
const url = `http://${process.env.LANGFLOW_SERVER_URL ?? ""}/api/v1/responses`;
|
||||
|
||||
const options = {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
"Content-Type": `application/json`,
|
||||
"x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
|
||||
},
|
||||
body: JSON.stringify({
|
||||
"model": "FLOW_ID",
|
||||
"input": "Calculate 23 * 15 and show me the result",
|
||||
"stream": false,
|
||||
"include": [
|
||||
"tool_call.results"
|
||||
]
|
||||
}),
|
||||
};
|
||||
|
||||
fetch(url, options)
|
||||
.then(async (response) => {
|
||||
if (!response.ok) {
|
||||
throw new Error(`HTTP ${response.status}`);
|
||||
}
|
||||
const text = await response.text();
|
||||
console.log(text);
|
||||
})
|
||||
.catch((error) => console.error(error));
|
||||
@ -0,0 +1,24 @@
|
||||
const url = `${process.env.LANGFLOW_SERVER_URL ?? ""}/api/v1/responses`;
|
||||
|
||||
const options = {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
"x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
|
||||
"Content-Type": `application/json`,
|
||||
},
|
||||
body: JSON.stringify({
|
||||
"model": "FLOW_ID",
|
||||
"input": "Explain quantum computing in simple terms",
|
||||
"stream": false
|
||||
}),
|
||||
};
|
||||
|
||||
fetch(url, options)
|
||||
.then(async (response) => {
|
||||
if (!response.ok) {
|
||||
throw new Error(`HTTP ${response.status}`);
|
||||
}
|
||||
const text = await response.text();
|
||||
console.log(text);
|
||||
})
|
||||
.catch((error) => console.error(error));
|
||||
Reference in New Issue
Block a user