Skip to main content

Provider-specific Swarmauri import package for DeepSeek OpenAI-compatible chat completions, reasoning models, streaming, async, and batch LLM workflows.

Project description

Swarmauri Logo

PyPI - Downloads Hits PyPI - Python Version PyPI - License PyPI - swarmauri_llm_deepseek Discord

Swarmauri DeepSeek LLM

swarmauri_llm_deepseek provides the provider-specific DeepSeekModel import for Swarmauri applications that call DeepSeek's OpenAI-compatible chat completion API. Install this package when a project should depend on the DeepSeek adapter directly while keeping the runtime implementation aligned with swarmauri_standard.

The adapter formats Swarmauri Conversation history as chat messages, sends requests to DeepSeek chat completions, and appends the provider response as an AgentMessage. It supports synchronous calls, asynchronous calls, streaming, and simple batch workflows for assistants, coding agents, reasoning workflows, and model-provider experiments.

DeepSeek's current API documentation describes an OpenAI-compatible chat API and lists deepseek-v4-flash and deepseek-v4-pro as current model IDs. This package currently defaults to the compatibility aliases deepseek-chat and deepseek-reasoner, which DeepSeek documents as mapped compatibility model names.

Why Use This Package?

  • Keep DeepSeek-specific imports explicit in application dependencies.
  • Use Swarmauri conversation and message primitives instead of hand-rolled request dictionaries throughout the application.
  • Swap DeepSeek with other Swarmauri LLM provider packages while preserving the same high-level predict, stream, apredict, and astream workflows.
  • Use DeepSeek reasoning and chat models through one Swarmauri adapter surface.

FAQ

What does swarmauri_llm_deepseek install?

It installs a provider package that exports DeepSeekModel from swarmauri_standard.llms.DeepSeekModel and registers the same model entry point for Swarmauri plugin discovery.

Which DeepSeek endpoint does the adapter call?

The implementation creates HTTP clients with the configured DeepSeek base URL and posts to /chat/completions using DeepSeek's OpenAI-compatible chat completion payload shape.

Which models are available?

The package default is deepseek-chat, with deepseek-reasoner also listed in allowed_models. DeepSeek's public documentation now also lists deepseek-v4-flash and deepseek-v4-pro as current model IDs, so production deployments should verify model availability against the DeepSeek platform before pinning a model name.

Does the package expose DeepSeek reasoning content?

The current Swarmauri adapter stores the assistant's final response content on the conversation. DeepSeek-specific reasoning fields are not exposed as a separate Swarmauri message property by this package.

Features

  • Provider-specific DeepSeekModel import for Swarmauri applications.
  • Synchronous chat completion through predict.
  • Asynchronous chat completion through apredict.
  • Token streaming through stream and astream.
  • Batch helpers through batch and abatch.
  • Configurable chat generation parameters including temperature, max_tokens, top_p, stop, frequency_penalty, and presence_penalty.
  • Compatibility with Python 3.10, 3.11, 3.12, 3.13, and 3.14.

Installation

uv add swarmauri_llm_deepseek
pip install swarmauri_llm_deepseek

Prerequisites

Create a DeepSeek API key in the DeepSeek platform and pass it to DeepSeekModel(api_key=...). The tests in this package look for DEEPSEEK_API_KEY when running live provider checks.

Usage

from swarmauri_llm_deepseek import DeepSeekModel
from swarmauri_standard.conversations.Conversation import Conversation
from swarmauri_standard.messages.HumanMessage import HumanMessage

conversation = Conversation()
conversation.add_message(
    HumanMessage(content="Summarize why OpenAI-compatible APIs are useful.")
)

model = DeepSeekModel(api_key="DEEPSEEK_API_KEY")
result = model.predict(conversation=conversation, max_tokens=200)

print(result.get_last().content)

Streaming

from swarmauri_llm_deepseek import DeepSeekModel
from swarmauri_standard.conversations.Conversation import Conversation
from swarmauri_standard.messages.HumanMessage import HumanMessage

conversation = Conversation()
conversation.add_message(HumanMessage(content="Write a three-line release note."))

model = DeepSeekModel(api_key="DEEPSEEK_API_KEY")

for token in model.stream(conversation=conversation):
    print(token, end="")

Async Prediction

import asyncio

from swarmauri_llm_deepseek import DeepSeekModel
from swarmauri_standard.conversations.Conversation import Conversation
from swarmauri_standard.messages.HumanMessage import HumanMessage


async def main() -> None:
    conversation = Conversation()
    conversation.add_message(HumanMessage(content="Explain agent memory in one paragraph."))

    model = DeepSeekModel(api_key="DEEPSEEK_API_KEY")
    result = await model.apredict(conversation=conversation)
    print(result.get_last().content)


asyncio.run(main())

Related Packages

Foundational Swarmauri Packages

Provider Documentation

Best Practices

  • Keep DeepSeek credentials in environment variables or a secrets manager.
  • Confirm current model names and availability in the DeepSeek platform before production deployment.
  • Use deepseek-reasoner only when the workflow benefits from reasoning-model behavior; the current adapter records the final answer content.
  • Set explicit max_tokens and timeout expectations for long-running reasoning requests.

License

Apache-2.0

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

swarmauri_llm_deepseek-0.11.0.dev1.tar.gz (8.2 kB view details)

Uploaded Source

Built Distribution

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

swarmauri_llm_deepseek-0.11.0.dev1-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

Details for the file swarmauri_llm_deepseek-0.11.0.dev1.tar.gz.

File metadata

  • Download URL: swarmauri_llm_deepseek-0.11.0.dev1.tar.gz
  • Upload date:
  • Size: 8.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for swarmauri_llm_deepseek-0.11.0.dev1.tar.gz
Algorithm Hash digest
SHA256 711ebefc0a6cc359d2ba21bbf10b22672ff7aca37cfb965b3e86471049b6d5fd
MD5 2e35340f42dcd75b633b5291c334a05c
BLAKE2b-256 abda77b8ee554ef226a472cde8ce79d3ca50c004e22ff2e39a91113cb399f14b

See more details on using hashes here.

File details

Details for the file swarmauri_llm_deepseek-0.11.0.dev1-py3-none-any.whl.

File metadata

  • Download URL: swarmauri_llm_deepseek-0.11.0.dev1-py3-none-any.whl
  • Upload date:
  • Size: 9.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for swarmauri_llm_deepseek-0.11.0.dev1-py3-none-any.whl
Algorithm Hash digest
SHA256 af6d3e477f498697fecb1dc3144024559f42c32665e3fbd03efb445f67dfc896
MD5 53e412ff20f87a2715c32b9b66ade97b
BLAKE2b-256 133f5124c6e8698638543ac54e715ebdcada36bbde38c9094552b64acb0dca77

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