summaryrefslogtreecommitdiff
path: root/Omni/Bild/Deps/pydantic-ai.nix
blob: 399649d062f5ae8e05927cd12669c342f6435058 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
{
  lib,
  buildPythonPackage,
  hatchling,
  pydantic-ai-slim,
  pythonOlder,
  pytest-vcr,
  dirty-equals,
  sources,
  writeTextFile,
}: let
  version = sources.pydantic-ai.version;
  pyproject_toml = writeTextFile {
    name = "pyproject.toml";
    text = ''
      [build-system]
      requires = ["hatchling"]
      build-backend = "hatchling.build"

      [project]
      name = "pydantic-ai"
      version = "${version}"
      description = "Agent Framework / shim to use Pydantic with LLMs"
      authors = [
          { name = "Samuel Colvin", email = "samuel@pydantic.dev" },
          { name = "Marcelo Trylesinski", email = "marcelotryle@gmail.com" },
          { name = "David Montague", email = "david@pydantic.dev" },
          { name = "Alex Hall", email = "alex@pydantic.dev" },
      ]
      license = "MIT"
      readme = "README.md"
      requires-python = ">=3.9"
      dependencies = [
        "pydantic-ai-slim[openai,vertexai,groq,anthropic,mistral,cohere,bedrock,cli,mcp,evals]==${version}",
      ]

      [project.urls]
      Homepage = "https://ai.pydantic.dev"
      Source = "https://github.com/pydantic/pydantic-ai"
      Documentation = "https://ai.pydantic.dev"
      Changelog = "https://github.com/pydantic/pydantic-ai/releases"

      [project.scripts]
      pai = "pydantic_ai._cli:app"
    '';
  };
in
  buildPythonPackage rec {
    pname = "pydantic-ai";
    inherit version;
    pyproject = true;
    disabled = pythonOlder "3.8";
    src = sources.pydantic-ai;
    build-system = [hatchling];
    dependencies = [pydantic-ai-slim];
    nativeCheckInputs = [
      pydantic-ai-slim
      pytest-vcr
      dirty-equals
      # pytestCheckHook
    ];
    preBuild = ''
      cp ${pyproject_toml} ./pyproject.toml
    '';
    pythonImportsCheck = [
      "pydantic_ai"
    ];
    meta = {
      description = "Agent Framework / shim to use Pydantic with LLMs";
      homepage = "https://github.com/pydantic/pydantic-ai";
      changelog = "https://github.com/pydantic/pydantic-ai/releases/tag/v${version}";
      license = lib.licenses.mit;
      maintainers = with lib.maintainers; [bsima];
    };
  }