Skip to content

Commit

Permalink
adjusted route in langchaincallroute
Browse files Browse the repository at this point in the history
  • Loading branch information
ArtxRod17 committed May 2, 2024
1 parent bffa0a9 commit 8361eac
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions backend/routes/langchainCallRoute.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,29 @@ langchainCallRoute.post("/updateTokenLimit", async (req, res) => {
}
});

//Endpoint for HuggingFaceSQLCAll
langchainCallRoute.post("/askhf", async (req, res) => {
//call fastapi from this endpoint
try {
//get user input
const userInput = req.body.data;

//make request to fastapi server
const fastResponse = await axios.post(
"http://langchain:8000/hfprocesstext",
{
human_input: userInput,
}
);

//response from fastapi
const dataFromFastapi = fastResponse.data;

res.json({ message: "Successful call to FastAPI", dataFromFastapi });
} catch (error) {
console.error("Error calling FastAPI", error);
res.status(500).json({ error: "Failed to call FastAPI" });
}
});

export default langchainCallRoute;

0 comments on commit 8361eac

Please sign in to comment.