如何使用程式碼範例開始使用 Dell Pro AI Studio

Summary: 瞭解可協助開發人員和 IT 專業人員開始運用 Dell Pro AI Studio 強大功能的基本程式碼範例。

This article applies to This article does not apply to This article is not tied to any specific product. Not all product versions are identified in this article.

Instructions

Dell Pro AI Studio 是全方位工具組,可簡化和加速 Dell AI 電腦上 AI 應用程式的開發、部署及管理作業。


受影響的產品:

  • Dell Pro AI Studio

我的程式目前使用 OpenAI API,並設定為使用雲端服務。如何轉換為使用 Dell Pro AI Studio 本機模型和運算?

Dell Pro AI Studio 旨在將特定工作負載直接轉移至本機運算。如果您目前的 AI 應用程式使用 OpenAI API 設定,您可能有一些類似於以下代碼的代碼:

Python 程式碼範例:

client = OpenAI(
base_url="https://your-custom-endpoint",
api_key="your-api-key",
)
注意:
  • your-custom-endpoint = 自訂終端節點的 URL
  • your-api-key = 您的 AI 的 API 金鑰

安裝 Dell Pro AI Studio 後,您可以將應用程式組態從上述變更為下方。

Python 程式碼範例:

client = OpenAI(
    base_url="http://localhost:8553/v1/openai",
    api_key="dpais"
)

我的應用程式需要串流功能,Dell Pro AI Studio 框架是否支援串流?

完全!通常,代碼需要在函數調用中添加 Stream 關鍵字參數。

使用 Phi 3.5 的 HTTP 代碼範例:

{
        "model": "phi3.5",
        "messages": [
            {"role": "system", "content": "You are a helpful assistant."},
            {"role": "user",   "content": "Hello"},
        ],
        "stream": "true"
    }

Python 程式碼範例:

messages=[{"role": "system", "content": "You are concise."},
                {"role": "user",   "content": "Say hi"}]
resp = client.chat.completions.create(
            model=Phi3.5,
            messages=messages,
            stream=True,
        )

Affected Products

Dell Pro AI Studio
Article Properties
Article Number: 000322409
Article Type: How To
Last Modified: 24 Oct 2025
Version:  2
Find answers to your questions from other Dell users
Support Services
Check if your device is covered by Support Services.