Getting Started with Praxos
This quickstart guide will help you integrate and utilize the Praxos effectively. You’ll learn how to:
- Configure your development environment
- Initialize the Praxos client
- Create and manage environments
- Add conversations to the knowledge graph
- Retrieve contextual information
Prerequisites
Before you begin, ensure you have:
- A valid Praxos API key (see API Key Instructions)
- Python 3.6 or higher installed
- Basic understanding of Python programming
Environment Setup
- Install the Praxos Python SDK:
pip install -U praxos-python
- Configure your API key:
import requests
# Replace with your Praxos API key
API_KEY = "YOUR_API_KEY"
Initialize the Client
Create a Praxos client instance and initialize an environment:
from praxos_python import SyncClient
# Initialize the client with your API key
client = SyncClient(api_key=API_KEY)
# Create a new environment
env = client.create_environment(name="MyEnvironment")
To learn more about client please review this page.
Add Conversations to Knowledge Graph
Add LLM conversations to the Praxos knowledge graph:
from raxos_python.types.message import Message
messages = [
Message(role="user", content="Hello, I am using Praxos knowledge graph, and it's awesome."),
Message(role="assistant", content="Hi there! I'm glad you're exploring Praxos knowledge graph. It's a powerful tool for managing and retrieving contextual information.")
]
source = env.add_conversation(
messages=messages,
source_name="My Conversation", # Optional identifier
description="A sample conversation" # Optional description
)
To learn more about environment please review this page.
Monitor Indexing Status
The knowledge graph requires time to index new sources. Indexing duration varies based on source size. Ensure indexing is complete before querying:
import time
# Wait for indexing to complete
while source.get_status() != "success":
time.sleep(1)
More document about source is available here
Retrieve Contextual Information
Query the knowledge graph to retrieve relevant context:
# Query the knowledge graph
context = env.get_context("what is the name of knowledge graph tool?")
print(context.sentence)
Example output:
a KnowledgeGraphTool, (which is a Tool), (category: Physical), identified as '67B770787F48A6Eac8C8B578 683A42Bb3983E0Bef0E2D031 683A42Bb3983E0Bef0E2D030 0 Tool Praxoskg', which has attribute ToolName 'Praxos knowledge graph' (base: NameType), and has attribute ToolFunctionalityDescription 'powerful tool for managing and retrieving contextual information' (base: DescriptionType). has attribute ToolName 'Praxos knowledge graph' (base: NameType).
The retrieved context can be utilized to enhance LLM responses for your specific use case.