Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions docs/content/en/latest/execution/ai/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
title: "GoodData AI (beta)"
linkTitle: "GoodData AI (beta)"
weight: 24
no_list: true
---

GoodData AI is a feature that allows you to ask questions about your data in natural language.

For more information on how to use and setup GoodData AI, see the [GoodData AI documentation](https://www.gooddata.com/docs/cloud/ai/).

## Methods

* [ai_chat](./ai_chat/)
* [ai_chat_stream](./ai_chat_stream/)
* [get_ai_chat_history](./get_ai_chat_history/)
* [reset_ai_chat_history](./reset_ai_chat_history/)
* [set_ai_chat_history_feedback](./set_ai_chat_history_feedback/)
* [search_ai](./search_ai/)
* [sync_metadata](./sync_metadata/)


## Example

This example shows how to use the GoodData AI to get execution definition. You can also use it to get a pandas dataframe, but for that you need to use the [GoodPandas](../../pandas/).

```python
from gooddata_sdk import GoodDataSdk # For AI chat and execution definition.
from gooddata_pandas import GoodDataPandas # For pandas dataframe.


host = "https://www.example.com"
token = "<your_personal_access_token>"
sdk = GoodDataSdk.create(host, token)

# Get execution definition from AI chat (not needed for pandas dataframe)
response = sdk.compute.ai_chat(test_workspace_id, "Display the revenue by product")
execution_definition = sdk.compute.buid_exec_def_from_chat_result(response)

# Create a pandas dataframe from the AI response.
gp = GoodDataPandas(host, token)
gdf = gp.data_frames(workspace_id)
df, df_metadata = gdf.for_created_visualization(response)

# Print the results
print(execution_definition) # Execution Definition.
print(df_metadata) # Dataframe metadata.
print(df) # Pandas dataframe.
```
40 changes: 40 additions & 0 deletions docs/content/en/latest/execution/ai/ai_chat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
title: "ai_chat"
linkTitle: "ai_chat"
weight: 92
superheading: "compute."
---

``ai_chat(workspace_id: str, question: str) -> ChatResult``

Chat with AI in GoodData workspace.


{{% parameters-block title="Parameters" %}}
{{< parameter p_name="workspace_id" p_type="str" >}}
The ID of the GoodData Workspace.
{{< /parameter >}}
{{< parameter p_name="question" p_type="str" >}}
The question to ask the AI.
{{< /parameter >}}
{{% /parameters-block %}}

{{% parameters-block title="Returns"%}}
{{< parameter p_name="chat_result" p_type="ChatResult" >}}
Chat response
{{< /parameter >}}
{{% /parameters-block %}}


## Example

```python

host = "https://www.example.com"
token = "<your_personal_access_token>"
sdk = GoodDataSdk.create(host, token)

chat_result = sdk.compute.ai_chat(workspace_id, "Display the revenue by product")

print(chat_result)
```
37 changes: 37 additions & 0 deletions docs/content/en/latest/execution/ai/ai_chat_stream.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
title: "ai_chat_stream"
linkTitle: "ai_chat_stream"
weight: 93
superheading: "compute."
---

``ai_chat_stream(workspace_id: str, question: str) -> Iterator[Any]``

Chat with AI in GoodData workspace. Stream the response.


{{% parameters-block title="Parameters" %}}
{{< parameter p_name="workspace_id" p_type="str" >}}
The ID of the GoodData Workspace.
{{< /parameter >}}
{{< parameter p_name="question" p_type="str" >}}
The question to ask the AI.
{{< /parameter >}}
{{% /parameters-block %}}

{{% parameters-block title="Returns"%}}
{{< parameter p_name="chat_result" p_type="Iterator[Any]" >}}
Yields parsed JSON objects from each SSE event's data field{{< /parameter >}}
{{% /parameters-block %}}


## Example

```python

host = "https://www.example.com"
token = "<your_personal_access_token>"
sdk = GoodDataSdk.create(host, token)

chat_result = sdk.compute.ai_chat_stream(workspace_id, "Display the revenue by product")
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
title: "build_exec_def_from_chat_result"
linkTitle: "build_exec_def_from_chat_result"
weight: 95
superheading: "compute."
---

``build_exec_def_from_chat_result(chat_result: ChatResult) -> ExecutionDefinition``

Build execution definition from chat result.


{{% parameters-block title="Parameters" %}}
{{< parameter p_name="chat_result" p_type="ChatResult" >}}
ChatResult object containing visualization details from AI chat response
{{< /parameter >}}
{{% /parameters-block %}}

{{% parameters-block title="Returns" %}}
{{< parameter p_name="execution_definition" p_type="ExecutionDefinition" >}}
ExecutionDefinition object containing the execution definition for the visualization
{{< /parameter >}}
{{% /parameters-block %}}


## Example

```python

host = "https://www.example.com"
token = "<your_personal_access_token>"
sdk = GoodDataSdk.create(host, token)

chat_result = sdk.compute.ai_chat(workspace_id, "Display the revenue by product")
execution_definition = sdk.compute.build_exec_def_from_chat_result(chat_result)

print(execution_definition)
```
40 changes: 40 additions & 0 deletions docs/content/en/latest/execution/ai/get_ai_chat_history.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
title: "ai_chat"
linkTitle: "ai_chat"
weight: 96
superheading: "compute."
---

``ai_chat(workspace_id: str, question: str) -> ChatResult``

Chat with AI in GoodData workspace.


{{% parameters-block title="Parameters" %}}
{{< parameter p_name="workspace_id" p_type="str" >}}
The ID of the GoodData Workspace.
{{< /parameter >}}
{{< parameter p_name="question" p_type="str" >}}
The question to ask the AI.
{{< /parameter >}}
{{% /parameters-block %}}

{{% parameters-block title="Returns"%}}
{{< parameter p_name="chat_result" p_type="ChatResult" >}}
Chat response
{{< /parameter >}}
{{% /parameters-block %}}


## Example

```python

host = "https://www.example.com"
token = "<your_personal_access_token>"
sdk = GoodDataSdk.create(host, token)

chat_result = sdk.compute.ai_chat(workspace_id, "Display the revenue by product")

print(chat_result)
```
32 changes: 32 additions & 0 deletions docs/content/en/latest/execution/ai/reset_ai_chat_history.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
title: "reset_ai_chat_history"
linkTitle: "reset_ai_chat_history"
weight: 97
superheading: "compute."
---

``reset_ai_chat_history(workspace_id: str) -> None``

Reset AI chat history in GoodData workspace.


{{% parameters-block title="Parameters" %}}
{{< parameter p_name="workspace_id" p_type="str" >}}
The ID of the GoodData Workspace.
{{< /parameter >}}
{{% /parameters-block %}}

{{% parameters-block title="Returns" None="true"%}}
{{% /parameters-block %}}


## Example

```python

host = "https://www.example.com"
token = "<your_personal_access_token>"
sdk = GoodDataSdk.create(host, token)

sdk.compute.reset_ai_chat_history(workspace_id)
```
64 changes: 64 additions & 0 deletions docs/content/en/latest/execution/ai/search_ai.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
---
title: "search_ai"
linkTitle: "search_ai"
weight: 98
superheading: "compute."
---

``search_ai(
workspace_id: str,
question: str,
deep_search: Optional[bool] = None,
limit: Optional[int] = None,
object_types: Optional[list[str]] = None,
relevant_score_threshold: Optional[float] = None,
title_to_descriptor_ratio: Optional[float] = None,
) -> SearchResult:``

Search for metadata objects using similarity search.

Default values for optional parameters are documented in the AI Search endpoint of the GoodData API.


{{% parameters-block title="Parameters" %}}
{{< parameter p_name="workspace_id" p_type="str" >}}
The ID of the GoodData Workspace.
{{< /parameter >}}
{{< parameter p_name="question" p_type="str" >}}
The question to ask the AI.
{{< /parameter >}}
{{< parameter p_name="deep_search" p_type="Optional[bool]" >}}
turn on deep search - if true, content of complex objects will be searched as well
{{< /parameter >}}
{{< parameter p_name="limit" p_type="Optional[int]" >}}
maximum number of results to return. Defaults to None.
{{< /parameter >}}
{{< parameter p_name="object_types" p_type="Optional[list[str]]" >}}
list of object types to search for. Enum items: "attribute", "metric", "fact", "label", "date", "dataset", "visualization" and "dashboard". Defaults to None.
{{< /parameter >}}
{{< parameter p_name="relevant_score_threshold" p_type="Optional[float]" >}}
minimum relevance score threshold for results. Defaults to None.
{{< /parameter >}}
{{< parameter p_name="title_to_descriptor_ratio" p_type="Optional[float]" >}}
ratio of title score to descriptor score. Defaults to None.
{{< /parameter >}}
{{% /parameters-block %}}

{{% parameters-block title="Returns"%}}
{{< parameter p_name="search_result" p_type="SearchResult" >}}
SearchResult: Search results{{< /parameter >}}
{{% /parameters-block %}}


## Example

```python

host = "https://www.example.com"
token = "<your_personal_access_token>"
sdk = GoodDataSdk.create(host, token)

chat_result = sdk.compute.ai_chat(workspace_id, "Display the revenue by product")

print(chat_result)
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
title: "set_ai_chat_history_feedback"
linkTitle: "set_ai_chat_history_feedback"
weight: 101
superheading: "compute."
---
``set_ai_chat_history_feedback(workspace_id: str, interaction_id: str, user_feedback: str, chat_history_interaction_id: str, thread_id_suffix: str = "") -> None``

Set feedback for an AI chat history interaction.


{{% parameters-block title="Parameters" %}}
{{< parameter p_name="workspace_id" p_type="str" >}}
workspace identifier
{{< /parameter >}}
{{< parameter p_name="interaction_id" p_type="str" >}}
feedback to provide ("POSITIVE", "NEGATIVE" or "NONE").
{{< /parameter >}}
{{< parameter p_name="user_feedback" p_type="str" >}}
interaction id to provide feedback for.
{{< /parameter >}}
{{< parameter p_name="chat_history_interaction_id" p_type="str" >}}
suffix to identify a specific chat thread. Defaults to "".
{{< /parameter >}}
{{% /parameters-block %}}

{{% parameters-block title="Returns" None="true"%}}
{{% /parameters-block %}}


## Example

```python

host = "https://www.example.com"
token = "<your_personal_access_token>"
sdk = GoodDataSdk.create(host, token)

sdk.compute.set_ai_chat_history_feedback(workspace_id, "POSITIVE", "123", "456")
```
35 changes: 35 additions & 0 deletions docs/content/en/latest/execution/ai/sync_metadata.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
title: "sync_metadata"
linkTitle: "sync_metadata"
weight: 100
superheading: "compute."
---

``sync_metadata(workspace_id: str, async_req: bool = False) -> None``

Sync metadata in GoodData workspace.


{{% parameters-block title="Parameters" %}}
{{< parameter p_name="workspace_id" p_type="str" >}}
The ID of the GoodData Workspace.
{{< /parameter >}}
{{< parameter p_name="async_req" p_type="bool" >}}
Whether to perform the request asynchronously.
{{< /parameter >}}
{{% /parameters-block %}}

{{% parameters-block title="Returns" None="true"%}}
{{% /parameters-block %}}


## Example

```python

host = "https://www.example.com"
token = "<your_personal_access_token>"
sdk = GoodDataSdk.create(host, token)

sdk.compute.sync_metadata(workspace_id)
```
Loading