Skip to content

Latest commit

 

History

History
1083 lines (833 loc) · 45.9 KB

File metadata and controls

1083 lines (833 loc) · 45.9 KB

English | 中文翻译 | 日本語翻訳 | French

julep


ドキュメントを見る · 不和 · 𝕏 · リンクトイン

NPM Version   PyPI - Version   Docker Image Version   GitHub License


[!注意] 👨‍💻 devfest.ai イベントに参加しませんか? Discord に参加して、以下の詳細を確認してください。

API キーを こちら から取得します。

🌟 貢献者とDevFest.AI参加者(クリックして拡大)

🌟 貢献者を募集します!

Julep プロジェクトに新しい貢献者を迎えられることを嬉しく思います。プロジェクトを始めるのに役立つ「最初の良い問題」をいくつか作成しました。貢献する方法は次のとおりです。

  1. 貢献方法に関するガイドラインについては、CONTRIBUTING.md ファイルをご覧ください。
  2. good first issues を参照して、興味のあるタスクを見つけます。
  3. ご質問やご不明な点がございましたら、Discord チャンネルまでお気軽にお問い合わせください。

あなたの貢献は、大小を問わず私たちにとって貴重です。一緒に素晴らしいものを作りましょう!🚀

🎉 DevFest.AI 2024年10月

嬉しいニュースです!2024 年 10 月を通して DevFest.AI に参加します!🗓️

  • このイベント中に Julep に貢献すると、素晴らしい Julep のグッズや景品を獲得するチャンスが得られます! 🎁
  • 世界中の開発者とともに AI リポジトリに貢献し、素晴らしいイベントに参加しましょう。
  • この素晴らしい取り組みを企画してくださった DevFest.AI に心から感謝します。

[!ヒント] 楽しみに参加する準備はできましたか? **参加することをツイート**して、コーディングを始めましょう! 🖥️

Julep DevFest.AI

📖 Table of Contents

## 導入

Julep は、過去のやり取りを記憶し、複雑なタスクを実行できる AI エージェントを作成するためのプラットフォームです。長期記憶を提供し、複数ステップのプロセスを管理します。

Julep を使用すると、意思決定、ループ、並列処理、多数の外部ツールや API との統合を組み込んだ複数ステップのタスクを作成できます。

多くの AI アプリケーションは、分岐が最小限の、プロンプトと API 呼び出しの単純な線形チェーンに制限されていますが、Julep はより複雑なシナリオを処理できるように構築されています。

サポート対象:

  • 複雑で多段階のプロセス
  • ダイナミックな意思決定
  • 並列実行

[!ヒント] 単純な質問に答えるだけでなく、複雑なタスクを処理し、過去のやり取りを記憶し、場合によっては他のツールや API も使用できる AI エージェントを構築したいとします。そこで Julep の出番です。

簡単な例

次のことができる研究 AI エージェントを想像してください。

  1. トピックを取り上げ、
  2. そのトピックについて100個の検索クエリを考えます。
  3. ウェブ検索を並行して実行する
  4. 結果をまとめる 5.要約をDiscordに送信する

Julepでは、これは単一のタスクになります80行のコードそして走る完全に管理されたすべては Julep のサーバー上で実行されます。すべての手順は Julep のサーバー上で実行されるため、何もする必要はありません。次に動作例を示します。

name: Research Agent

# Optional: Define the input schema for the task
input_schema:
  type: object
  properties:
    topic:
      type: string
      description: The main topic to research

# Define the tools that the agent can use
tools:
- name: web_search
  type: integration
  integration:
    provider: brave
    setup:
      api_key: "YOUR_BRAVE_API_KEY"

- name: discord_webhook
  type: api_call
  api_call:
    url: "YOUR_DISCORD_WEBHOOK_URL"
    method: POST
    headers:
      Content-Type: application/json

# Special variables:
# - inputs: for accessing the input to the task
# - outputs: for accessing the output of previous steps
# - _: for accessing the output of the previous step

# Define the main workflow
main:
- prompt:
    - role: system
      content: >-
        You are a research assistant.
        Generate 100 diverse search queries related to the topic:
        {{inputs[0].topic}}

        Write one query per line.
  unwrap: true

# Evaluate the search queries using a simple python expression
- evaluate:
    search_queries: "_.split('\n')"

# Run the web search in parallel for each query
- over: "_.search_queries"
  map:
    tool: web_search
    arguments:
      query: "_"
  parallelism: 100

# Collect the results from the web search
- evaluate:
    results: "'\n'.join([item.result for item in _])"

# Summarize the results
- prompt:
    - role: system
      content: >
        You are a research summarizer. Create a comprehensive summary of the following research results on the topic {{inputs[0].topic}}.
        The summary should be well-structured, informative, and highlight key findings and insights:
        {{_.results}}
  unwrap: true

# Send the summary to Discord
- tool: discord_webhook
  arguments:
    content: >
      **Research Summary for {{inputs[0].topic}}**

      {{_}}

[!ヒント] Julep は、長期的なインタラクションを通じてコン​​テキストと状態を維持できる AI エージェントを構築する場合に非常に便利です。複雑な複数ステップのワークフローを設計し、さまざまなツールや API をエージェントのプロセスに直接統合するのに最適です。

この例では、Julep は並列実行を自動的に管理し、失敗したステップを再試行し、API リクエストを再送信し、タスクが完了するまで確実に実行し続けます。

主な特徴

  1. 🧠 永続的な AI エージェント: 長期にわたるやり取りを通じてコン​​テキストと情報を記憶します。
  2. 💾 ステートフル セッション: 過去のやり取りを追跡して、パーソナライズされた応答を提供します。
  3. 🔄 複数ステップのタスク: ループと意思決定を使用して、複雑な複数ステップのプロセスを構築します。
  4. タスク管理: 無期限に実行される可能性のある長時間実行タスクを処理します。
  5. 🛠️ 組み込みツール: タスクで組み込みツールと外部 API を使用します。
  6. 🔧 自己修復: Julep は失敗したステップを自動的に再試行し、メッセージを再送信し、タスクをスムーズに実行し続けます。
  7. 📚 RAG: Julep のドキュメント ストアを使用して、独自のデータを取得して使用するためのシステムを構築します。

Julep は、単純なプロンプト応答モデルを超えた AI ユースケースを必要とするアプリケーションに最適です。

Julep と LangChain を比較する理由

さまざまなユースケース

LangChain と Julep は、AI 開発スタック内で異なる重点を置いたツールと考えてください。

LangChain は、プロンプトのシーケンスを作成し、AI モデルとのやり取りを管理するのに最適です。多数の事前構築された統合を備えた大規模なエコシステムを備えているため、何かをすぐに立ち上げて実行したい場合に便利です。LangChain は、プロンプトと API 呼び出しの線形チェーンを含む単純なユースケースに適しています。

一方、Julep は、長期的なインタラクションを通じて物事を記憶できる永続的な AI エージェントの構築に重点を置いています。エージェントのプロセス内で複数のステップ、意思決定、さまざまなツールや API との直接統合を伴う複雑なタスクが必要な場合に効果を発揮します。永続的なセッションと複雑なタスクを管理するために、ゼロから設計されています。

以下のことが必要となる複雑な AI アシスタントの構築を考えている場合には、Julep を使用してください。

  • 数日または数週間にわたってユーザーのインタラクションを追跡します。
  • 毎日のサマリーの送信やデータ ソースの監視などのスケジュールされたタスクを実行します。
  • 以前のやり取りや保存されたデータに基づいて決定を下します。
  • タスクの一部として複数の外部サービスと対話します。

そして、Julep は、ゼロから構築する必要なく、これらすべてをサポートするインフラストラクチャを提供します。

異なるフォームファクタ

Julep は、タスクを記述するための言語、それらのタスクを実行するためのサーバー、プラットフォームと対話するための SDK を含む プラットフォーム です。Julep で何かを構築するには、タスクの説明を YAML で記述し、クラウドでタスクを実行します。

Julep は、負荷の高い、複数のステップから成る、長時間実行されるタスク向けに構築されており、タスクの複雑さに制限はありません。

LangChain は、プロンプトとツールの線形チェーンを構築するためのいくつかのツールとフレームワークを含む ライブラリ です。LangChain を使用して何かを構築するには、通常、使用するモデル チェーンを設定して実行する Python コードを記述します。

LangChain は、プロンプトと API 呼び出しの線形チェーンを含む単純なユースケースでは十分であり、実装も迅速です。

### 要約すれば

ステートレスまたは短期的なコンテキストで AI モデルのインタラクションとプロンプト シーケンスを管理する必要がある場合は、LangChain を使用します。

高度なタスク機能、永続的なセッション、複雑なタスク管理を備えたステートフル エージェント用の堅牢なフレームワークが必要な場合は、Julep を選択してください。

インストール

Julep を使い始めるには、npm または pip を使用してインストールします。

npm install @julep/sdk

または

pip install julep

[!注意] API キーを こちら から取得します。

ベータ版では、Discord に連絡して、API キーのレート制限を解除することもできます。

[!ヒント] 💻 あなたは「コードを見せてください!™」タイプの人ですか? 始めるにあたって役立つクックブックを多数作成しました。クックブック をチェックして、例を参照してください。

💡 Julep をベースに構築できるアイデアもたくさんあります。アイデアのリスト をチェックして、インスピレーションを得てください。

Python クイックスタート 🐍

ステップ 1: エージェントを作成する

import yaml
from julep import Julep # or AsyncJulep

client = Julep(api_key="your_julep_api_key")

agent = client.agents.create(
    name="Storytelling Agent",
    model="gpt-4o",
    about="You are a creative storytelling agent that can craft engaging stories and generate comic panels based on ideas.",
)

# 🛠️ Add an image generation tool (DALL·E) to the agent
client.agents.tools.create(
    agent_id=agent.id,
    name="image_generator",
    description="Use this tool to generate images based on descriptions.",
    integration={
        "provider": "dalle",
        "method": "generate_image",
        "setup": {
            "api_key": "your_openai_api_key",
        },
    },
)

ステップ2: ストーリーと漫画を生成するタスクを作成する

入力されたアイデアに基づいてストーリーを作成し、パネル化された漫画を生成するためのマルチステップタスクを定義しましょう。

# 📋 Task
# Create a task that takes an idea and creates a story and a 4-panel comic strip
task_yaml = """
name: Story and Comic Creator
description: Create a story based on an idea and generate a 4-panel comic strip illustrating the story.

main:
  # Step 1: Generate a story and outline into 4 panels
  - prompt:
      - role: system
        content: You are {{agent.name}}. {{agent.about}}
      - role: user
        content: >
          Based on the idea '{{_.idea}}', write a short story suitable for a 4-panel comic strip.
          Provide the story and a numbered list of 4 brief descriptions for each panel illustrating key moments in the story.
    unwrap: true

  # Step 2: Extract the panel descriptions and story
  - evaluate:
      story: _.split('1. ')[0].strip()
      panels: re.findall(r'\\d+\\.\\s*(.*?)(?=\\d+\\.\\s*|$)', _)

  # Step 3: Generate images for each panel using the image generator tool
  - foreach:
      in: _.panels
      do:
        tool: image_generator
        arguments:
          description: _

  # Step 4: Generate a catchy title for the story
  - prompt:
      - role: system
        content: You are {{agent.name}}. {{agent.about}}
      - role: user
        content: >
          Based on the story below, generate a catchy title.

          Story: {{outputs[1].story}}
    unwrap: true

  # Step 5: Return the story, the generated images, and the title
  - return:
      title: outputs[3]
      story: outputs[1].story
      comic_panels: "[output.image.url for output in outputs[2]]"
"""

task = client.tasks.create(
    agent_id=agent.id,
    **yaml.safe_load(task_yaml)
)

ステップ3: タスクを実行する

# 🚀 Execute the task with an input idea
execution = client.executions.create(
    task_id=task.id,
    input={"idea": "A cat who learns to fly"}
)

# 🎉 Watch as the story and comic panels are generated
for transition in client.executions.transitions.stream(execution_id=execution.id):
    print(transition)

# 📦 Once the execution is finished, retrieve the results
result = client.executions.get(execution_id=execution.id)

ステップ4: エージェントとチャットする

エージェントとの対話型チャット セッションを開始します。

session = client.sessions.create(agent_id=agent.id)

# 💬 Send messages to the agent
while (message := input("Enter a message: ")) != "quit":
    response = client.sessions.chat(
        session_id=session.id,
        message=message,
    )

    print(response)

[!ヒント] 完全な Python の例は ここ にあります。

Node.js クイックスタート 🟩

ステップ 1: エージェントを作成する

import { Julep } from '@julep/sdk';
import yaml from 'js-yaml';

const client = new Julep({ apiKey: 'your_julep_api_key' });

async function createAgent() {
  const agent = await client.agents.create({
    name: "Storytelling Agent",
    model: "gpt-4",
    about: "You are a creative storytelling agent that can craft engaging stories and generate comic panels based on ideas.",
  });

  // 🛠️ Add an image generation tool (DALL·E) to the agent
  await client.agents.tools.create(agent.id, {
    name: "image_generator",
    description: "Use this tool to generate images based on descriptions.",
    integration: {
      provider: "dalle",
      method: "generate_image",
      setup: {
        api_key: "your_openai_api_key",
      },
    },
  });

  return agent;
}

ステップ2: ストーリーと漫画を生成するタスクを作成する

const taskYaml = `
name: Story and Comic Creator
description: Create a story based on an idea and generate a 4-panel comic strip illustrating the story.

main:
  # Step 1: Generate a story and outline into 4 panels
  - prompt:
      - role: system
        content: You are {{agent.name}}. {{agent.about}}
      - role: user
        content: >
          Based on the idea '{{_.idea}}', write a short story suitable for a 4-panel comic strip.
          Provide the story and a numbered list of 4 brief descriptions for each panel illustrating key moments in the story.
    unwrap: true

  # Step 2: Extract the panel descriptions and story
  - evaluate:
      story: _.split('1. ')[0].trim()
      panels: _.match(/\\d+\\.\\s*(.*?)(?=\\d+\\.\\s*|$)/g)

  # Step 3: Generate images for each panel using the image generator tool
  - foreach:
      in: _.panels
      do:
        tool: image_generator
        arguments:
          description: _

  # Step 4: Generate a catchy title for the story
  - prompt:
      - role: system
        content: You are {{agent.name}}. {{agent.about}}
      - role: user
        content: >
          Based on the story below, generate a catchy title.

          Story: {{outputs[1].story}}
    unwrap: true

  # Step 5: Return the story, the generated images, and the title
  - return:
      title: outputs[3]
      story: outputs[1].story
      comic_panels: outputs[2].map(output => output.image.url)
`;

async function createTask(agent) {
  const task = await client.tasks.create(agent.id, yaml.load(taskYaml));
  return task;
}

ステップ3: タスクを実行する

async function executeTask(task) {
  const execution = await client.executions.create(task.id, {
    input: { idea: "A cat who learns to fly" }
  });

  // 🎉 Watch as the story and comic panels are generated
  for await (const transition of client.executions.transitions.stream(execution.id)) {
    console.log(transition);
  }

  // 📦 Once the execution is finished, retrieve the results
  const result = await client.executions.get(execution.id);
  return result;
}

ステップ4: エージェントとチャットする

async function chatWithAgent(agent) {
  const session = await client.sessions.create({ agent_id: agent.id });

  // 💬 Send messages to the agent
  const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
  });

  const chat = async () => {
    rl.question("Enter a message (or 'quit' to exit): ", async (message) => {
      if (message.toLowerCase() === 'quit') {
        rl.close();
        return;
      }

      const response = await client.sessions.chat(session.id, { message });
      console.log(response);
      chat();
    });
  };

  chat();
}

// Run the example
async function runExample() {
  const agent = await createAgent();
  const task = await createTask(agent);
  const result = await executeTask(task);
  console.log("Task Result:", result);
  await chatWithAgent(agent);
}

runExample().catch(console.error);

[!ヒント] 完全な Node.js の例は ここ にあります。

コンポーネント

Julep は次のコンポーネントで構成されています。

  • Julep プラットフォーム: Julep プラットフォームは、ワークフローを実行するクラウド サービスです。ワークフローを記述するための言語、ワークフローを実行するためのサーバー、プラットフォームと対話するための SDK が含まれています。
  • Julep SDK: Julep SDK は、ワークフローを構築するためのライブラリのセットです。Python 用と JavaScript 用の SDK があり、今後さらに追加される予定です。
  • Julep API: Julep API は、Julep プラットフォームと対話するために使用できる RESTful API です。

メンタルモデル

Julep は、クライアント側とサーバー側の両方のコンポーネントを組み合わせて、高度な AI エージェントの構築を支援するプラットフォームと考えてください。これを視覚化する方法は次のとおりです。

  1. アプリケーションコード:
  • アプリケーションで Julep SDK を使用して、エージェント、タスク、ワークフローを定義します。
  • SDK は、これらのコンポーネントのセットアップと管理を容易にする関数とクラスを提供します。
  1. Julep バックエンド サービス:
  • SDK はネットワーク経由で Julep バックエンドと通信します。
  • バックエンドは、タスクの実行を処理し、セッション状態を維持し、ドキュメントを保存し、ワークフローを調整します。
  1. ツールとAPIとの統合:
  • ワークフロー内で、外部ツールやサービスを統合できます。
  • バックエンドはこれらの統合を容易にするため、エージェントは、たとえば、Web 検索を実行したり、データベースにアクセスしたり、サードパーティの API を呼び出したりすることができます。

もっと簡単に言うと:

  • Julep は、ステートフル AI エージェントを構築するためのプラットフォームです。
  • コード内で SDK (ツールキットのようなもの) を使用して、エージェントの動作を定義します。
  • バックエンド サービス (エンジンと考えることができます) は、これらの定義を実行し、状態を管理し、複雑さを処理します。

コンセプト

Julep は、強力な AI ワークフローを作成するために連携するいくつかの主要な技術コンポーネントに基づいて構築されています。

graph TD
    User[User] ==> Session[Session]
    Session --> Agent[Agent]
    Agent --> Tasks[Tasks]
    Agent --> LLM[Large Language Model]
    Tasks --> Tools[Tools]
    Agent --> Documents[Documents]
    Documents --> VectorDB[Vector Database]
    Tasks --> Executions[Executions]

    classDef client fill:#9ff,stroke:#333,stroke-width:1px;
    class User client;

    classDef core fill:#f9f,stroke:#333,stroke-width:2px;
    class Agent,Tasks,Session core;
Loading
  • エージェント: タスクを実行し、ユーザーと対話する大規模言語モデル (LLM) を搭載した AI 搭載エンティティ。
  • ユーザー: セッションを通じてエージェントと対話するエンティティ。
  • セッション: エージェントとユーザー間のステートフルなやり取り。複数のやり取りにわたってコンテキストを維持します。
  • タスク: プロンプト、ツール呼び出し、条件付きロジックなどのさまざまな種類のステップを含む、エージェントが実行できる複数ステップのプログラム ワークフロー。
  • ツール: ユーザー定義関数、システム ツール、サードパーティ API 統合など、エージェントの機能を拡張する統合。
  • ドキュメント: エージェントまたはユーザーに関連付けられたテキストまたはデータ オブジェクト。セマンティック検索と取得のためにベクトル化され、保存されます。
  • 実行: 特定の入力で開始され、独自のライフサイクルとステート マシンを持つタスクのインスタンス。

これらの概念とその相互作用の詳細な説明については、概念ドキュメントを参照してください。

タスクを理解する

タスクは Julep のワークフロー システムの中核です。タスクを使用すると、エージェントが実行できる複雑な複数ステップの AI ワークフローを定義できます。タスク コンポーネントの概要は次のとおりです。

  • 名前と説明: 各タスクには、簡単に識別できるように一意の名前と説明が付いています。
  • メインステップ: タスクの中核であり、実行されるアクションのシーケンスを定義します。
  • ツール: タスク実行中にエージェントの機能を拡張するオプションの統合。

ワークフローステップの種類

Julep のタスクにはさまざまな種類のステップを含めることができるため、複雑で強力なワークフローを作成できます。利用可能なステップの種類の概要をカテゴリ別にまとめると次のようになります。

一般的な手順

  1. プロンプト: AI モデルにメッセージを送信し、応答を受信します。

    - prompt: "Analyze the following data: {{data}}"
  2. ツール呼び出し: 統合ツールまたは API を実行します。

    - tool: web_search
      arguments:
        query: "Latest AI developments"
  3. 評価: 計算を実行したり、データを操作したりします。

    - evaluate:
        average_score: "sum(scores) / len(scores)"
  4. 入力を待機: 入力が受信されるまでワークフローを一時停止します。

    - wait_for_input:
        info:
          message: "Please provide additional information."
  5. ログ: 指定された値またはメッセージをログに記録します。

    - log: "Processing completed for item {{item_id}}"

キー値ステップ

  1. Get: キー値ストアから値を取得します。

    - get: "user_preference"
  2. Set: キー値ストア内のキーに値を割り当てます。

    - set:
        user_preference: "dark_mode"

反復ステップ

  1. Foreach: コレクションを反復処理し、各項目に対して手順を実行します。

    - foreach:
        in: "data_list"
        do:
          - log: "Processing item {{_}}"
  2. Map-Reduce: コレクションをマップし、結果を縮小します。

    - map_reduce:
        over: "numbers"
        map:
          - evaluate:
              squared: "_ ** 2"
        reduce: "sum(results)"
  3. 並列: 複数のステップを並列に実行します。

    - parallel:
        - tool: web_search
          arguments:
            query: "AI news"
        - tool: weather_check
          arguments:
            location: "New York"

条件付きステップ

  1. If-Else: ステップの条件付き実行。

    - if: "score > 0.8"
      then:
        - log: "High score achieved"
      else:
        - log: "Score needs improvement"
  2. スイッチ: 複数の条件に基づいてステップを実行します。

    - switch:
        - case: "category == 'A'"
          then:
            - log: "Category A processing"
        - case: "category == 'B'"
          then:
            - log: "Category B processing"
        - case: "_"  # Default case
          then:
            - log: "Unknown category"

その他の制御フロー

  1. スリープ: 指定した期間、ワークフローを一時停止します。

    - sleep:
        seconds: 30
  2. Return: ワークフローから値を返します。

    - return:
        result: "Task completed successfully"
  3. Yield: サブワークフローを実行し、完了を待ちます。

    - yield:
        workflow: "data_processing_subflow"
        arguments:
          input_data: "{{raw_data}}"
  4. エラー: エラー メッセージを指定してエラーを処理します。

    - error: "Invalid input provided"

各ステップ タイプは、高度な AI ワークフローを構築する上で特定の目的を果たします。この分類は、Julep タスクで使用できるさまざまな制御フローと操作を理解するのに役立ちます。

ツールの種類

エージェントには、さまざまな「ツール」へのアクセスを許可できます。これは、基盤モデルが一連の入力を使用して「呼び出す」ことができるプログラム インターフェイスです。たとえば、インターネットで何らかの情報を検索するには、web_search(query) ツールを使用します。

エージェント フレームワークとは異なり、julep はエージェントの実行を管理する バックエンド です。クライアントは SDK を使用してエージェントと対話できます。julep はタスクの実行と統合の実行を担当します。

julep のツールは次のいずれかになります。

ユーザー定義の function

これらは、[openai] の関数呼び出しの仕組みと同様に、モデルに選択させることができる関数シグネチャです。例:

    name: Example system tool task
    description: List agents using system call

    tools:
    - name: send_notification
      description: Send a notification to the user
      type: function
      function:
        parameters:
          type: object
          properties:
            text:
              type: string
              description: Content of the notification

    main:
    - tool: send_notification
      arguments:
        content: hi

julep は、ユーザー定義関数 に遭遇するたびに一時停止し、制御をクライアントに戻し、クライアントが関数呼び出しを実行して結果を julep に返すのを待ちます。

[!ヒント] サンプルクックブック: cookbooks/13-Error_Handling_and_Recovery.py

システム ツール

タスク実行のトリガー、メタデータ フィールドへの追加など、julep API 自体を呼び出すために使用できる組み込みツール。 system ツールはバックエンドに組み込まれています。必要に応じて自動的に実行されます。クライアント側からのアクションは必要ありません。

例えば、

  name: Example system tool task
  description: List agents using system call

  tools:
  - name: list_agents
    description: List all agents
    type: system
    system:
      resource: agent
      operation: list
  main:
  - tool: list_agents
    arguments:
      limit: 10

[!ヒント] サンプルクックブック: cookbooks/10-Document_Management_and_Search.py​​

組み込みの integration

Julep には、多数の組み込み統合が付属しています (以下のセクションで説明)。integration ツールは、julep バックエンドで直接実行されます。実行時に必要な追加パラメータは、エージェント/セッション/ユーザーの metadata フィールドで設定できます。

[!ヒント] サンプルクックブック: cookbooks/01-Website_Crawler_using_Spider.ipynb

julep バックエンドには、次のプロバイダーからの統合サードパーティ ツールが付属しています。

** composioanon はサードパーティプロバイダーであるため、それらのツールではアカウントリンクを設定する必要があります。

直接の api_call

julep は、ワークフロー実行中にツール呼び出しとして直接 API 呼び出しを行うこともできます。integration と同様に、追加のランタイム パラメータは metadata フィールドから読み込まれます。

例えば、

  name: Example api_call task
  tools:
  - type: api_call
    name: hello
    api_call:
      method: GET
      url: https://httpbin.org/get
  main:
  - tool: hello
    arguments:
      params:
        test: _.input

統合

Julep は、AI エージェントの機能を拡張するさまざまな統合をサポートしています。利用可能な統合とサポートされている引数のリストは次のとおりです。

ブレイブサーチ

setup:
  api_key: string  # The API key for Brave Search

arguments:
  query: string  # The search query for searching with Brave

output:
  result: string  # The result of the Brave Search

[!ヒント] サンプルクックブック: cookbooks/03-SmartResearcher_With_WebSearch.ipynb

ブラウザベース

setup:
  api_key: string       # The API key for BrowserBase
  project_id: string    # The project ID for BrowserBase
  session_id: string    # (Optional) The session ID for BrowserBase

arguments:
  urls: list[string]    # The URLs for loading with BrowserBase

output:
  documents: list       # The documents loaded from the URLs

メール

setup:
  host: string      # The host of the email server
  port: integer     # The port of the email server
  user: string      # The username of the email server
  password: string  # The password of the email server

arguments:
  to: string        # The email address to send the email to
  from: string      # The email address to send the email from
  subject: string   # The subject of the email
  body: string      # The body of the email

output:
  success: boolean  # Whether the email was sent successfully

[!ヒント] サンプルクックブック: cookbooks/00-Devfest-Email-Assistant.ipynb

スパイダー

setup:
  spider_api_key: string  # The API key for Spider

arguments:
  url: string             # The URL for which to fetch data
  mode: string            # The type of crawlers (default: "scrape")
  params: dict            # (Optional) The parameters for the Spider API

output:
  documents: list         # The documents returned from the spider

[!ヒント] サンプルクックブック: cookbooks/01-Website_Crawler_using_Spider.ipynb

### 天気

setup:
  openweathermap_api_key: string  # The API key for OpenWeatherMap

arguments:
  location: string                # The location for which to fetch weather data

output:
  result: string                  # The weather data for the specified location

[!ヒント] サンプルクックブック: cookbooks/04-TripPlanner_With_Weather_And_WikiInfo.ipynb

ウィキペディア

arguments:
  query: string           # The search query string
  load_max_docs: integer  # Maximum number of documents to load (default: 2)

output:
  documents: list         # The documents returned from the Wikipedia search

[!ヒント] サンプルクックブック: cookbooks/04-TripPlanner_With_Weather_And_WikiInfo.ipynb

これらの統合をタスク内で使用して、AI エージェントの機能を拡張できます。ワークフローでこれらの統合を使用する方法の詳細については、統合ドキュメントを参照してください。

その他の機能

Julep は、AI ワークフローを強化するためのさまざまな高度な機能を提供します。

エージェントへのツールの追加

外部ツールと API を統合してエージェントの機能を拡張します。

client.agents.tools.create(
    agent_id=agent.id,
    name="web_search",
    description="Search the web for information.",
    integration={
        "provider": "brave",
        "method": "search",
        "setup": {"api_key": "your_brave_api_key"},
    },
)

セッションとユーザーの管理

Julep は、永続的なインタラクションのための堅牢なセッション管理を提供します。

session = client.sessions.create(
    agent_id=agent.id,
    user_id=user.id,
    context_overflow="adaptive"
)

# Continue conversation in the same session
response = client.sessions.chat(
    session_id=session.id,
    messages=[
      {
        "role": "user",
        "content": "Follow up on the previous conversation."
      }
    ]
)

ドキュメントの統合と検索

エージェントのドキュメントを簡単に管理および検索できます。

# Upload a document
document = client.agents.docs.create(
    title="AI advancements",
    content="AI is changing the world...",
    metadata={"category": "research_paper"}
)

# Search documents
results = client.agents.docs.search(
    text="AI advancements",
    metadata_filter={"category": "research_paper"}
)

ローカルクイックスタート

要件

  • 最新の docker compose がインストールされている

手順:

  1. git clone https://github.com/julep-ai/julep.git
  2. cd ジュレップ
  3. docker volume create cozo_backup
  4. docker volume create cozo_data
  5. cp .env.example .env # <-- このファイルを編集します
  6. docker compose --env-file .env --profile temporal-ui --profile single-tenant --profile self-hosted-db up --build

SDK リファレンス

APIリファレンス

エージェント、タスク、実行の詳細については、包括的な API ドキュメントをご覧ください。