Skip to content
Open
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
8 changes: 8 additions & 0 deletions src/oss/python/integrations/providers/all_providers.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2504,6 +2504,14 @@ Browse the complete collection of integrations available for Python. LangChain P
Q&A platform network integration.
</Card>

<Card
title="Stardog"
href="/oss/integrations/providers/stardog"
icon="link"
>
Enterprise knowledge graph platform.
</Card>

<Card
title="StarRocks"
href="/oss/integrations/providers/starrocks"
Expand Down
23 changes: 23 additions & 0 deletions src/oss/python/integrations/providers/stardog.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
title: Stardog
---

[Stardog](https://www.stardog.com) is an enterprise knowledge graph platform that enables organizations to unify, query, and analyze their data.

Give agents a tool to:

- Ask natural language questions and get hallucination-free answers from your enterprise knowledge graph database
- Generate SPARQL queries from natural language
- Query and analyze structured data using semantic reasoning
- Access enterprise data through a conversational interface

### How it works
Stardog provides knowledge graph infrastructure that combines data integration with natural language processing:

1. Give your agent access to enterprise knowledge graphs
2. Query data using natural language through Voicebox
3. Get accurate, grounded answers backed by your data

## Installation and Setup

Check out the [tool documentation](/oss/integrations/tools/stardog) to see how to set up and use the available tools.
2 changes: 2 additions & 0 deletions src/oss/python/integrations/tools/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ The following table shows tools that can be used to automate tasks in databases:
| [MCP Toolbox](/oss/integrations/tools/toolbox) | Any SQL operation |
| [SQLDatabase Toolkit](/oss/integrations/tools/sql_database) | Any SQL operation |
| [Spark SQL Toolkit](/oss/integrations/tools/spark_sql) | Any SQL operation |
| [Stardog](/oss/integrations/tools/stardog) | SPARQL SELECT and schema introspection |

## Finance

Expand Down Expand Up @@ -216,6 +217,7 @@ The following platforms provide access to multiple tools and services through a
<Card title="Spark SQL Toolkit" icon="link" href="/oss/integrations/tools/spark_sql" arrow="true" cta="View guide" />
<Card title="SQLDatabase Toolkit" icon="link" href="/oss/integrations/tools/sql_database" arrow="true" cta="View guide" />
<Card title="StackExchange" icon="link" href="/oss/integrations/tools/stackexchange" arrow="true" cta="View guide" />
<Card title="Stardog" icon="link" href="/oss/integrations/tools/stardog" arrow="true" cta="View guide" />
<Card title="Steam Toolkit" icon="link" href="/oss/integrations/tools/steam" arrow="true" cta="View guide" />
<Card title="Stripe" icon="link" href="/oss/integrations/tools/stripe" arrow="true" cta="View guide" />
<Card title="Tableau" icon="link" href="/oss/integrations/tools/tableau" arrow="true" cta="View guide" />
Expand Down
130 changes: 130 additions & 0 deletions src/oss/python/integrations/tools/stardog.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
---
title: Stardog
---

>[Stardog](https://www.stardog.com) is an enterprise knowledge graph platform that enables organizations to unify, query, and analyze their data.
> This integration package provides langchain tools and runnables for interacting with Stardog Voicebox, which is a natural language answering agent providing hallucination-free insights from your enterprise data.

## Overview

The Stardog LangChain integration package provides the following tools for working with Stardog Voicebox:
- `VoiceboxAskTool` - Ask questions and get natural language answers
- `VoiceboxGenerateQueryTool` - Generate SPARQL queries from natural language
- `VoiceboxSettingsTool` - Retrieve Voicebox application settings

All tools support both synchronous and asynchronous execution modes, making them suitable for various application architectures.

For complete details, see the [GitHub repository](https://github.com/stardog-union/stardog-langchain).

## Setup

### Installation

```bash
pip install langchain-stardog
```

### Prerequisites

- A [Stardog Cloud](https://cloud.stardog.com) account
- A Voicebox application configured with your data
- A Voicebox API token

### Getting Your API Token

1. Log in to [Stardog Cloud](https://cloud.stardog.com)
2. Click on your profile icon and select **Manage API Keys**.
3. Create a new application and generate a secret.
4. Copy the API token and keep it secure.
5. For more details, see Stardog Voicebox API access.

### Credentials

Set your API token as an environment variable:

```python
import getpass
import os

if not os.environ.get("SD_VOICEBOX_API_TOKEN"):
os.environ["SD_VOICEBOX_API_TOKEN"] = getpass.getpass("Enter your Voicebox API token: ")
```

Optional environment variables:

```python
os.environ["SD_VOICEBOX_CLIENT_ID"] = "my-app" # Client identifier (default: VBX-LANGCHAIN)
os.environ["SD_CLOUD_ENDPOINT"] = "https://cloud.stardog.com/api" # Custom endpoint (optional)
```

## Instantiation and Examples

### VoiceboxAskTool

Ask natural language questions relevant to the knowledge graph configured with your API token, and receive hallucination-free answers.

```python
from langchain_stardog.voicebox import VoiceboxAskTool

# Tools automatically load credentials from environment variables
ask_tool = VoiceboxAskTool()

# Ask a question
result = ask_tool.invoke({"question": "What are all flights from San Francisco to New York?"})
print(result)
# Returns: Natural language answer
```

### VoiceboxSettingsTool

Retrieve Voicebox application configuration and metadata.

```python
from langchain_stardog.voicebox import VoiceboxSettingsTool

settings_tool = VoiceboxSettingsTool()

# Get application settings
settings = settings_tool.invoke({})
print(settings)
# Returns: Configuration details like data sources, schema info, and capabilities
```

### VoiceboxGenerateQueryTool

Generate SPARQL queries for the natural language question without executing them.

```python
from langchain_stardog.voicebox import VoiceboxGenerateQueryTool

query_tool = VoiceboxGenerateQueryTool()

# Generate a SPARQL query
query = query_tool.invoke({"question": "Which flights are delayed by more than 30 minutes?"})
print(query)
# Returns: Generated SPARQL query without executing it
```

Refer to the [Examples](https://github.com/stardog-union/stardog-langchain?tab=readme-ov-file#examples) section for different ways to use these tools and runnables.

## Class Reference

For more details, see [Class Reference](https://github.com/stardog-union/stardog-langchain?tab=readme-ov-file#class-reference)

**Available classes:**

- `VoiceboxAskTool` - Ask questions and get answers
- `VoiceboxSettingsTool` - Retrieve application settings
- `VoiceboxGenerateQueryTool` - Generate SPARQL queries
- `VoiceboxAskRunnable` - Runnable for asking natural language questions
- `VoiceboxSettingsRunnable` - Settings retrieval runnable
- `VoiceboxGenerateQueryRunnable` - Query generation runnable
- `VoiceboxClient` - Core client for Voicebox API


## Learn More

- [Stardog Voicebox Documentation](https://docs.stardog.com/voicebox)
- [Stardog Cloud](https://cloud.stardog.com)
- [GitHub Repository](https://github.com/stardog-union/stardog-langchain)
- [Stardog Community](https://community.stardog.com/)