/xpuls-ml-sdk

SDK for Interacting with xpuls.ai

Primary LanguagePythonApache License 2.0Apache-2.0

Welcome to xpuls.ai ๐Ÿ‘‹

xpuls-ml-sdk

Twitter Follow Discord

Website | Docs | Articles | Twitter | Community

PyPI version GitHub version

Roadmap ๐Ÿš€

Framework Status
Langchain โœ…
LLamaIndex Planned
PyTorch Planned
SKLearn Planned
Transformers Planned
Stable Diffusion Next

๐Ÿ’ก If support of any framework/feature is useful for you, please feel free to reach out to us via Discord or Github Discussions

๐Ÿ”— Installation

  1. Install from PyPI
pip install xpuls-ml-sdk

๐Ÿงฉ Usage Example

from xpuls.mlmonitor.langchain.instrument import LangchainTelemetry
import os
import xpuls
from xpuls.prompt_hub import PromptClient

# Enable this for advance tracking with our xpuls-ml platform
xpuls.host_url = "https://api.xpuls.ai"
xpuls.api_key = "********************"  # Get from https://platform.xpuls.ai
xpuls.adv_tracing_enabled = "true" # Enable this for automated insights and log tracing via xpulsAI platform
# Add default labels that will be added to all captured metrics
default_labels = {"service": "ml-project-service", "k8s_cluster": "app0", "namespace": "dev", "agent_name": "fallback_value"}

# Enable the auto-telemetry
LangchainTelemetry(default_labels=default_labels,).auto_instrument()
prompt_client = PromptClient(   
    prompt_id="clrfm4v70jnlb1kph240",  # Get prompt_id from the platform
    environment_name="dev"  # Deployed environment name
)

## [Optional] Override labels for scope of decorator [Useful if you have multiple scopes where you need to override the default label values]
@TelemetryOverrideLabels(agent_name="chat_agent_alpha")
@MapXpulsProject(project_slug="defaultoPIt9USSR")  # Get Project Slug from platform
def get_response_using_agent_alpha(prompt, query):
    agent = initialize_agent(llm=chat_model,
                             verbose=True,
                             agent=CONVERSATIONAL_REACT_DESCRIPTION,
                             memory=memory)
    
    data = prompt_client.get_prompt({"variable-1": "I'm the first variable"})  # Substitute any variables in prompt

    res = agent.run(data) # Pass the entire `XPPrompt` object to run or invoke method

โ„น๏ธ Complete Usage Guides

๐Ÿงพ License

This project is licensed under the Apache License 2.0. See the LICENSE file for more details.

๐Ÿ“ข Contributing

We welcome contributions to xpuls-ml-sdk! If you're interested in contributing.

If you encounter any issues or have feature requests, please file an issue on our GitHub repository.

๐Ÿ’ฌ Get in touch

๐Ÿ‘‰ Join our Discord community!

๐Ÿฆ Follow the latest from xpuls.ai team on Twitter @xpulsai

๐Ÿ“ฎ Write to us at hello@xpuls.ai