LangStream / langstream

LangStream. Event-Driven Developer Platform for Building and Running LLM AI Apps. Powered by Kubernetes and Kafka.
https://langstream.ai
Apache License 2.0
379 stars 28 forks source link

[python] Add new agent type python-service #665

Closed eolivelli closed 8 months ago

eolivelli commented 8 months ago

Summary:

when you are running in docker the auto-reload feature works out of the box, as soon as you change your Python files the Python daemon is restarted

It is expected that the langstream gateway will act as a proxy to the service, adding:

Running Python application on Kubernetes

LangStream agents are already deployed as a StatefulSet (with persistent disks) and an headless Service. Deploying an application here allows you to easily leverage all the Kubernetes features, for instance:

Bonus feature added by this PR:

When you declare a Python agent you can easily pass environment variables from secrets:

module: default
name: "Basic LangServe application"
pipeline:
  - name: "Start LangServe"
    id: agent1
    type: "python-service"
    configuration:
      className: example.ChatBotService
      environment:
        - key: "OPENAI_API_KEY"
          value: "${secrets.open-ai.access-key}"
        - key: "LANGCHAIN_TRACING_V2"
          value: "true"
        - key: "LANGCHAIN_ENDPOINT"
          value: "${ secrets.lang-smith.api-url }"
        - key: "LANGCHAIN_API_KEY"
          value: "${ secrets.lang-smith.api-key }"          

This PR adds a sample application about how to integrate also with LangSmith image