ishaan-mital commited on
Commit
083f629
·
1 Parent(s): 51d15eb

initial commit

Browse files
Files changed (1) hide show
  1. app.py +12 -1
app.py CHANGED
@@ -36,8 +36,19 @@ def call_llm_api(input_text):
36
  return response.json() # Adjust as needed based on your API response format
37
 
38
 
 
 
 
 
 
 
 
 
 
 
 
39
  rag_pipeline = RetrievalQA.from_chain_type(
40
- llm=call_llm_api, chain_type='stuff',
41
  retriever=vectorstore.as_retriever()
42
  )
43
 
 
36
  return response.json() # Adjust as needed based on your API response format
37
 
38
 
39
+ from langchain.llms import Runnable
40
+
41
+ class APIRunnable(Runnable):
42
+ def __init__(self, api_func):
43
+ self.api_func = api_func
44
+
45
+ def run(self, input_text):
46
+ return self.api_func(input_text)
47
+
48
+ api_runnable = APIRunnable(api_func=call_llm_api)
49
+
50
  rag_pipeline = RetrievalQA.from_chain_type(
51
+ llm=api_runnable, chain_type='stuff',
52
  retriever=vectorstore.as_retriever()
53
  )
54