Skip to main content

Core functionality for language tools

Project description

LangTools Core SDK

Background

LangTools vNext is a project aimed at enhancing developer experience in MAI, enabling faster experimentation and deployment of Generative AI-based features to swiftly deliver increased value to our users. The langtools-core SDK, serving as the foundation for LangTools vNext, offers essential tools for building services/GenAI applications, including AI-aware logging, tracing, metrics tracking, debugging, and evaluation.

Goal

  • Define the developer's experience of this package.
  • Define the functionality that the package should provide.
  • Design the user experience of the functionality such as logging, tracing, metrics tracking, and evaluation.
  • Identify the dependencies required by the package.
  • Propose public interfaces exposed by the package.

Non-Goal

  • Design of predefined metrics.
  • Prompty should not be included in the package, users can decide whether to leverage it.

Proposal

Langtools-core SDK is a Python package that will be published to PyPI. A .NET version will be supported in the future.

Package Functionality Imports (SDK)
langtools-core Logging capability from langtools.core import Logger
Tracing capability from langtools.core import Tracer
Metrics tracking capability from langtools.core import Meter

For detailed documentation on each component, please refer to the docs in the docs/core directory:

Package Structure

langtools.core
├── logger.py         # Main logger implementation
├── tracer.py         # Main tracer implementation
├── meter.py          # Main meter implementation
├── credential.py     # Main credential implementation
└── exporters/        # Built-in exporters
    ├── __init__.py
    ├── console_exporter.py
    ├── file_exporter.py
    └── azure_monitor.py
    └── noop_exporter.py
└── identity/        # Built-in identity
    ├── __init__.py
    ├── LongRunningOBOTokenCredential.py
└── utils/
    ├── openai_result_parser.py
    ├── serializer.py

Basic Usage Example

from langtools.core import Logger, Tracer, Meter
from langtools.core.exporters import ConsoleLogHandler, ConsoleSpanExporter, ConsoleMetricExporter
# Set up logger
Logger.basicConfig(handlers=[ConsoleLogHandler()])
logger = Logger.getLogger(__name__)

# Set up tracer
Tracer.initTracer("my-service", [ConsoleSpanExporter()])
tracer = Tracer.getTracer(__name__)

# Set up meter
Meter.initMeter("my-service", [ConsoleMetricExporter()])
meter = Meter.getMeter(__name__)

# Example usage
@tracer.trace
def example_function():
    logger.info("Starting example function")
    counter = meter.create_counter("function_calls")
    counter.add(1)
    logger.info("Finished example function")

example_function()

For more detailed examples and API documentation for each component, please refer to the individual documentation files in the docs/core directory.

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

langtools_core-0.1.0b1.tar.gz (21.2 kB view details)

Uploaded Source

Built Distribution

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

langtools_core-0.1.0b1-py3-none-any.whl (24.8 kB view details)

Uploaded Python 3

File details

Details for the file langtools_core-0.1.0b1.tar.gz.

File metadata

  • Download URL: langtools_core-0.1.0b1.tar.gz
  • Upload date:
  • Size: 21.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.13

File hashes

Hashes for langtools_core-0.1.0b1.tar.gz
Algorithm Hash digest
SHA256 237761707298187839a025cd30e4de7d0b70a8e4144445a11ef41722e358d3b2
MD5 075597eb04306d677fd63d1cb0fc6e6b
BLAKE2b-256 467dcf8504472b72028d162b0be117f42c1f5a9ce9f29a32d711138287a06f74

See more details on using hashes here.

File details

Details for the file langtools_core-0.1.0b1-py3-none-any.whl.

File metadata

File hashes

Hashes for langtools_core-0.1.0b1-py3-none-any.whl
Algorithm Hash digest
SHA256 455673d19c61d623c24d670dd2fd271396190be933582cf7b33e9a35e9b225f7
MD5 fef08fda8e0e20b06c15053533964418
BLAKE2b-256 19085393fd7b009f09d8011d56b1783f02f03e6676ea52944acf444ce1013b16

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