SDK for session (#2354)

### What problem does this PR solve?

Includes SDK for creating, updating sessions, getting sessions, listing
sessions, and dialogues
#1102 
### Type of change

- [x] New Feature (non-breaking change which adds functionality)

---------

Co-authored-by: liuhua <10215101452@stu.ecun.edu.cn>
This commit is contained in:
liuhua
2024-09-11 12:03:55 +08:00
committed by GitHub
parent 7fad48f42c
commit 1fc14ff6d4
7 changed files with 298 additions and 131 deletions

View File

@@ -17,7 +17,7 @@ from typing import List
import requests
from .modules.chat_assistant import Assistant
from .modules.assistant import Assistant
from .modules.dataset import DataSet
@@ -30,8 +30,8 @@ class RAGFlow:
self.api_url = f"{base_url}/api/{version}"
self.authorization_header = {"Authorization": "{} {}".format("Bearer", self.user_key)}
def post(self, path, param):
res = requests.post(url=self.api_url + path, json=param, headers=self.authorization_header)
def post(self, path, param, stream=False):
res = requests.post(url=self.api_url + path, json=param, headers=self.authorization_header, stream=stream)
return res
def get(self, path, params=None):