Merge pull request #1880 from langchain-ai/dqbd/sdk-xray

feat(sdk): expose xray kwarg to get_graph/getGraph
This commit is contained in:
David Duong
2024-09-27 16:59:51 +02:00
committed by GitHub
2 changed files with 19 additions and 6 deletions
+7 -2
View File
@@ -223,8 +223,13 @@ export class AssistantsClient extends BaseClient {
* @param assistantId The ID of the assistant.
* @returns Serialized graph
*/
async getGraph(assistantId: string): Promise<AssistantGraph> {
return this.fetch<AssistantGraph>(`/assistants/${assistantId}/graph`);
async getGraph(
assistantId: string,
options?: { xray?: boolean },
): Promise<AssistantGraph> {
return this.fetch<AssistantGraph>(`/assistants/${assistantId}/graph`, {
params: { xray: options?.xray },
});
}
/**
+12 -4
View File
@@ -304,11 +304,14 @@ class AssistantsClient:
""" # noqa: E501
return await self.http.get(f"/assistants/{assistant_id}")
async def get_graph(self, assistant_id: str) -> dict[str, list[dict[str, Any]]]:
async def get_graph(
self, assistant_id: str, *, xray: bool = False
) -> dict[str, list[dict[str, Any]]]:
"""Get the graph of an assistant by ID.
Args:
assistant_id: The ID of the assistant to get the graph of.
xray: Include graph representation of subgraphs.
Returns:
Graph: The graph information for the assistant in JSON format.
@@ -338,7 +341,9 @@ class AssistantsClient:
""" # noqa: E501
return await self.http.get(f"/assistants/{assistant_id}/graph")
return await self.http.get(
f"/assistants/{assistant_id}/graph", params={"xray": xray}
)
async def get_schemas(self, assistant_id: str) -> GraphSchema:
"""Get the schemas of an assistant by ID.
@@ -2068,11 +2073,14 @@ class SyncAssistantsClient:
""" # noqa: E501
return self.http.get(f"/assistants/{assistant_id}")
def get_graph(self, assistant_id: str) -> dict[str, list[dict[str, Any]]]:
def get_graph(
self, assistant_id: str, *, xray: bool = False
) -> dict[str, list[dict[str, Any]]]:
"""Get the graph of an assistant by ID.
Args:
assistant_id: The ID of the assistant to get the graph of.
xray: Include graph representation of subgraphs.
Returns:
Graph: The graph information for the assistant in JSON format.
@@ -2102,7 +2110,7 @@ class SyncAssistantsClient:
""" # noqa: E501
return self.http.get(f"/assistants/{assistant_id}/graph")
return self.http.get(f"/assistants/{assistant_id}/graph", params={"xray": xray})
def get_schemas(self, assistant_id: str) -> GraphSchema:
"""Get the schemas of an assistant by ID.