Skip to content
This repository was archived by the owner on Jan 5, 2025. It is now read-only.

Commit 7389dd4

Browse files
authored
Merge pull request #204 from openchatai/staging
Staging
2 parents d272330 + 1dd3fe9 commit 7389dd4

File tree

5 files changed

+39
-50
lines changed

5 files changed

+39
-50
lines changed

llm-server/routes/workflow/extractors/extract_body.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
llm = get_llm()
1414

1515

16-
def gen_body_from_schema(
16+
async def gen_body_from_schema(
1717
body_schema: str,
1818
text: str,
1919
prev_api_response: str,

llm-server/routes/workflow/extractors/extract_param.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
llm = get_llm()
1212

1313

14-
def gen_params_from_schema(
14+
async def gen_params_from_schema(
1515
param_schema: str, text: str, prev_resp: str, current_state: Optional[str]
1616
) -> Optional[JsonData]:
1717
chat = ChatOpenAI(

llm-server/routes/workflow/generate_openapi_payload.py

+36-42
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from typing import Dict, Any, Optional
1010

1111
from prance import ResolvingParser
12+
import asyncio
1213

1314
load_dotenv()
1415

@@ -88,48 +89,41 @@ def generate_openapi_payload(
8889
app: Optional[str],
8990
current_state: Optional[str],
9091
) -> ApiInfo:
91-
(
92-
a,
93-
b,
94-
c,
95-
) = swagger_json.version_parsed # (3,0,2), we can then apply transformation on
96-
print(a, b, c)
97-
# add transformation for swagger v2
98-
99-
api_info = get_api_info_by_operation_id(swagger_json.specification, _operation_id)
100-
101-
api_info.path_params = (
102-
{}
103-
if not api_info.path_params["properties"]
104-
else gen_params_from_schema(
105-
json.dumps(api_info.path_params, separators=(",", ":")),
106-
text,
107-
prev_api_response,
108-
current_state,
109-
)
110-
)
111-
api_info.query_params = (
112-
{}
113-
if not api_info.query_params["properties"]
114-
else gen_params_from_schema(
115-
json.dumps(api_info.query_params, separators=(",", ":")),
116-
text,
117-
prev_api_response,
118-
current_state,
119-
)
120-
)
92+
async def process_api_info():
93+
a, b, c = swagger_json.version_parsed
94+
print(a, b, c)
12195

122-
if api_info.body_schema:
123-
# example = gen_ex_from_schema(api_info.body_schema)
124-
api_info.body_schema = gen_body_from_schema(
125-
json.dumps(api_info.body_schema, separators=(",", ":")),
126-
text,
127-
prev_api_response,
128-
app,
129-
current_state,
96+
api_info = get_api_info_by_operation_id(
97+
swagger_json.specification, _operation_id
13098
)
13199

132-
else:
133-
api_info.body_schema = {}
134-
135-
return api_info
100+
if api_info.path_params["properties"]:
101+
api_info.path_params = await gen_params_from_schema(
102+
json.dumps(api_info.path_params, separators=(",", ":")),
103+
text,
104+
prev_api_response,
105+
current_state,
106+
)
107+
108+
if api_info.query_params["properties"]:
109+
api_info.query_params = await gen_params_from_schema(
110+
json.dumps(api_info.query_params, separators=(",", ":")),
111+
text,
112+
prev_api_response,
113+
current_state,
114+
)
115+
116+
if api_info.body_schema:
117+
api_info.body_schema = await gen_body_from_schema(
118+
json.dumps(api_info.body_schema, separators=(",", ":")),
119+
text,
120+
prev_api_response,
121+
app,
122+
current_state,
123+
)
124+
else:
125+
api_info.body_schema = {}
126+
127+
return api_info
128+
129+
return asyncio.run(process_api_info())

llm-server/routes/workflow/utils/detect_multiple_intents.py

-5
Original file line numberDiff line numberDiff line change
@@ -163,11 +163,6 @@ def hasSingleIntent(
163163
current_state
164164
)
165165
),
166-
# HumanMessage(
167-
# content="User this conversation history for lookups if necessary: ({})".format(
168-
# conversation_str
169-
# )
170-
# ),
171166
HumanMessage(
172167
content="Here's a list of api summaries {}.".format(summaries),
173168
),

llm-server/utils/vector_db/init_vector_store.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def init_vector_store(
5656
embeddings,
5757
collection_name=options.namespace.split("/")[-1],
5858
url=os.environ["QDRANT_URL"],
59-
api_key=os.getenv("QDRANT_API_KEY", ""),
59+
api_key=os.getenv("QDRANT_API_KEY", None),
6060
)
6161

6262
else:

0 commit comments

Comments
 (0)