Skip to main content

Universal LLM client for production - works with Claude, GPT-4, Gemini, Llama, and any LLM. Built-in integrations with Openclaw and LangChain.

Project description

Socratic Nexus (socrates-nexus)

Universal LLM abstraction layer providing unified access to multiple AI providers

Overview

socrates-nexus is a specialized component of the Socratic ecosystem that provides comprehensive functionality for universal llm abstraction layer providing unified access to multiple ai providers. It offers a production-ready, well-tested solution for integrating into larger Socratic systems.

Key Features

  • Multi-provider support
  • Unified client interface
  • Async/sync API support
  • Model standardization

Installation

Prerequisites

  • Python 3.8+
  • pip or poetry package manager

Via pip

pip install socrates-nexus

Via poetry

poetry add socrates-nexus

From source

git clone https://github.com/socratic-ai/socrates-nexus.git
cd socrates-nexus
pip install -e .

Quick Start

Basic Usage

from socrates_nexus import Client

# Initialize the component
client = Client()

# Perform basic operation
result = client.process()
print(result)

Configuration

from socrates_nexus import Client

# Configure with custom settings
client = Client(
    api_key="your-api-key",
    model="claude-3-5-haiku",
    timeout=30
)

# Use the client
response = client.query("What is the essence of learning?")

Core Components

  • Client: Main interface for interacting
  • Providers: Provider-specific implementations
  • Models: Model definitions and configurations
  • Async Client: Asynchronous version
  • Exceptions: Custom error handling

Architecture Overview

socrates-nexus follows a modular, layered architecture:

  • Client Layer: Public API for external consumers
  • Processing Layer: Core business logic and algorithms
  • Integration Layer: Connections to external services and APIs
  • Data Layer: State management and data persistence

Integration with Socratic Ecosystem

socrates-nexus integrates seamlessly with:

  • socrates-nexus: Unified LLM provider interface
  • socratic-rag: Knowledge retrieval and augmentation
  • socratic-core: Common utilities and base classes
  • Other ecosystem components: As needed for specific use cases

Dependencies

- anthropic
- openai
- google-generativeai
- langchain

Performance Considerations

  • Caching: Intelligent caching for frequently accessed data
  • Async Support: Full async/await support for non-blocking I/O
  • Scalability: Designed for high-concurrency scenarios
  • Resource Efficiency: Optimized memory and CPU usage

Error Handling

The library provides comprehensive error handling:

from socrates_nexus import Client, Error

try:
    client = Client()
    result = client.process()
except Error as e:
    print(f"Error: {e}")

Testing

Run the test suite:

pytest tests/

With coverage reporting:

pytest --cov=socrates_nexus tests/

API Reference

For complete API documentation, see ARCHITECTURE.md

Contributing

Contributions are welcome! See CONTRIBUTING.md for guidelines.

Support & Resources

License

MIT License - See LICENSE file for details


Part of the Socratic Ecosystem

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

socratic_nexus-0.3.1.tar.gz (61.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

socratic_nexus-0.3.1-py3-none-any.whl (44.9 kB view details)

Uploaded Python 3

File details

Details for the file socratic_nexus-0.3.1.tar.gz.

File metadata

  • Download URL: socratic_nexus-0.3.1.tar.gz
  • Upload date:
  • Size: 61.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for socratic_nexus-0.3.1.tar.gz
Algorithm Hash digest
SHA256 bc95b5ee2c0934ea1ed6f776ae9ad434fde32705fb178256d0f0f3977c1242a9
MD5 1753c97f21a333d010df6c625911b53d
BLAKE2b-256 4b03eaef8bbea02a5a1c65b69e0320a1d93e226df8085a828ac170c708007ed9

See more details on using hashes here.

File details

Details for the file socratic_nexus-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: socratic_nexus-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 44.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for socratic_nexus-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 daacc619a2ec09a0a090bc93a8b8d79571399fd591b1bf2282e2f705a5e55a88
MD5 9e17c1761709a6bb9e3b7b0b61c5bc97
BLAKE2b-256 d8878c000313acc6982c62211273f7210bdc8faaac444d5bc8d937d2cc39ba6c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page