Invoking langchain Chains and agents using REST API #19745
sasidharreddy25
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Checked
Feature request
from langchain.chains import create_sql_query_chain
from langchain_openai import ChatOpenAI
llm = ChatOpenAI(model="gpt-3.5-turbo", temperature=0)
chain = create_sql_query_chain(llm, db)
response = chain.invoke({"question": "How many employees are there"})
response
The above code takes openai endpoint, key in ChatOpenAI object to call openai when chain is invoked
In our scenario due to security reasons we have API Gateway infront of openai, so we need to hit API Gateway using REST API call, then it will route our request to openai.
So we are invoking API Gateway using python:
response=request.post(endpoint(api gateway), data=data)
But how can we integrate this REST API code with current above langchain code, it only takes direct openai endpoint and keys, but that is not the scenario in our case
Motivation
Due to the change in the way we call openai this problem a raises, please show us some solution for this problem
Proposal (If applicable)
No response
Beta Was this translation helpful? Give feedback.
All reactions