Update chat.py
Browse files
chat.py
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
|
|
| 1 |
from langchain_openai import ChatOpenAI
|
| 2 |
import json
|
| 3 |
from langchain_core.prompts import ChatPromptTemplate
|
|
@@ -6,7 +7,6 @@ from langchain.chains import ConversationChain
|
|
| 6 |
from langchain_google_genai import ChatGoogleGenerativeAI
|
| 7 |
from langchain_core.output_parsers import JsonOutputParser
|
| 8 |
from langchain_community.llms.cloudflare_workersai import CloudflareWorkersAI
|
| 9 |
-
import requests
|
| 10 |
|
| 11 |
from langchain_cohere import ChatCohere
|
| 12 |
def langchainConversation(conversation):
|
|
@@ -39,7 +39,6 @@ def converse(conversation,provider,model,key,other:dict={}):
|
|
| 39 |
api_token = key.split('~')[1]
|
| 40 |
except:
|
| 41 |
raise Exception('Invalid Accound Id or api token')
|
| 42 |
-
import requests
|
| 43 |
API_BASE_URL = f"https://api.cloudflare.com/client/v4/accounts/{account_id}/ai/run/"
|
| 44 |
headers = {"Authorization": f"Bearer {api_token}"}
|
| 45 |
|
|
|
|
| 1 |
+
import requests
|
| 2 |
from langchain_openai import ChatOpenAI
|
| 3 |
import json
|
| 4 |
from langchain_core.prompts import ChatPromptTemplate
|
|
|
|
| 7 |
from langchain_google_genai import ChatGoogleGenerativeAI
|
| 8 |
from langchain_core.output_parsers import JsonOutputParser
|
| 9 |
from langchain_community.llms.cloudflare_workersai import CloudflareWorkersAI
|
|
|
|
| 10 |
|
| 11 |
from langchain_cohere import ChatCohere
|
| 12 |
def langchainConversation(conversation):
|
|
|
|
| 39 |
api_token = key.split('~')[1]
|
| 40 |
except:
|
| 41 |
raise Exception('Invalid Accound Id or api token')
|
|
|
|
| 42 |
API_BASE_URL = f"https://api.cloudflare.com/client/v4/accounts/{account_id}/ai/run/"
|
| 43 |
headers = {"Authorization": f"Bearer {api_token}"}
|
| 44 |
|