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
387 stars 28 forks source link

[agents] Add Agent to call LangServe (langserve-invoke) #673

Closed eolivelli closed 11 months ago

eolivelli commented 11 months ago

Summary:

When doing streaming answers the chunking is performed the same way as the ai-chat-completion agent, and we are adding the same properties to the messages. This way the sample JS applications still work out of the box.

There is a sample application included with this PR.

Sample pipeline:

pipeline:
  - type: "langserve-invoke"
    input: input-topic
    output: output-topic
    id: step1
    configuration:
      output-field: value.answer
      stream-to-topic: streaming-answers-topic
      stream-response-field: value
      min-chunks-per-message: 10
      debug: false
      method: POST
      allow-redirects: true
      handle-cookies: false
      url: "http://host.docker.internal:8000/chain/stream"
      fields:
        - name: topic
          expression: "value"