@@ -57,22 +68,35 @@ export default function Header() {
diff --git a/src/frontend/src/constants.tsx b/src/frontend/src/constants.tsx
index 34d20211a..7017ac27e 100644
--- a/src/frontend/src/constants.tsx
+++ b/src/frontend/src/constants.tsx
@@ -121,11 +121,12 @@ export const getCurlCode = (flow: FlowType): string => {
*/
export const getPythonCode = (flow: FlowType): string => {
const flowName = flow.name;
+ const tweaks = buildTweaks(flow);
return `from langflow import load_flow_from_json
-
- flow = load_flow_from_json("${flowName}.json")
- # Now you can use it like any chain
- flow("Hey, have you heard of LangFlow?")`;
+TWEAKS = ${JSON.stringify(tweaks, null, 2)}
+flow = load_flow_from_json("${flowName}.json", tweaks=TWEAKS)
+# Now you can use it like any chain
+flow("Hey, have you heard of LangFlow?")`;
};
/**
diff --git a/src/frontend/src/controllers/API/index.ts b/src/frontend/src/controllers/API/index.ts
index f0c36a215..28a41d578 100644
--- a/src/frontend/src/controllers/API/index.ts
+++ b/src/frontend/src/controllers/API/index.ts
@@ -18,6 +18,18 @@ export async function getAll(): Promise
> {
return await axios.get(`/api/v1/all`);
}
+const GITHUB_API_URL = "https://api.github.com";
+
+export async function getRepoStars(owner, repo) {
+ try {
+ const response = await axios.get(`${GITHUB_API_URL}/repos/${owner}/${repo}`);
+ return response.data.stargazers_count;
+ } catch (error) {
+ console.error("Error fetching repository data:", error);
+ return null;
+ }
+}
+
/**
* Sends data to the API for prediction.
*
diff --git a/tests/test_loading.py b/tests/test_loading.py
index 885eb7a82..11fa8e471 100644
--- a/tests/test_loading.py
+++ b/tests/test_loading.py
@@ -14,6 +14,15 @@ def test_load_flow_from_json():
assert isinstance(loaded, Chain)
+def test_load_flow_from_json_with_tweaks():
+ """Test loading a flow from a json file and applying tweaks"""
+ tweaks = {"dndnode_82": {"model_name": "test model"}}
+ loaded = load_flow_from_json(pytest.BASIC_EXAMPLE_PATH, tweaks=tweaks)
+ assert loaded is not None
+ assert isinstance(loaded, Chain)
+ assert loaded.llm.model_name == "test model"
+
+
def test_get_root_node():
with open(pytest.BASIC_EXAMPLE_PATH, "r") as f:
flow_graph = json.load(f)