-
Notifications
You must be signed in to change notification settings - Fork 64
/
Copy pathmix.exs
124 lines (112 loc) · 3.57 KB
/
mix.exs
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
defmodule Instructor.MixProject do
use Mix.Project
@external_resource "README.md"
@version "README.md"
|> File.read!()
|> then(&Regex.run(~r/{:instructor, "~> (\d+\.\d+\.\d+)"}/, &1))
|> List.last()
def project do
[
app: :instructor,
version: @version,
elixir: "~> 1.15",
start_permanent: Mix.env() == :prod,
deps: deps(),
elixirc_paths: elixirc_paths(Mix.env()),
description: description(),
# Docs
name: "Instructor",
source_url: "https://github.com/thmsmlr/instructor_ex",
homepage_url: "https://github.com/thmsmlr/instructor_ex",
docs: [
main: "Instructor",
extras: [
"pages/quickstart.livemd",
"pages/philosophy.md",
"pages/llm-providers/llama-cpp.livemd",
"pages/llm-providers/ollama.livemd",
"pages/llm-providers/together.livemd",
"pages/cookbook/text-classification.livemd",
"pages/cookbook/qa-citations.livemd",
"pages/cookbook/extract-action-items-from-meeting-transcripts.livemd",
"pages/cookbook/text-to-dataframes.livemd",
"pages/cookbook/gpt4-vision.livemd"
],
groups_for_extras: [
"LLM Providers": ~r"pages/llm-providers/.*\.(md|livemd)",
Cookbook: ~r"pages/cookbook/.*\.(md|livemd)"
],
before_closing_body_tag: &before_closing_body_tag/1
],
package: package(),
aliases: aliases()
]
end
defp elixirc_paths(:test), do: ["lib", "test/support"]
defp elixirc_paths(_), do: ["lib"]
# Run "mix help compile.app" to learn about applications.
def application do
[
extra_applications: [:logger]
]
end
defp description do
"Structured prompting for OpenAI and OSS LLMs"
end
defp package do
[
maintainers: ["Thomas Millar"],
licenses: ["MIT"],
links: %{
"GitHub" => "https://github.com/thmsmlr/instructor_ex"
}
]
end
def before_closing_body_tag(:html) do
"""
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/mermaid.min.js"></script>
<script>
document.addEventListener("DOMContentLoaded", function () {
mermaid.initialize({
startOnLoad: false,
theme: document.body.className.includes("dark") ? "dark" : "default"
});
let id = 0;
for (const codeEl of document.querySelectorAll("pre code.mermaid")) {
const preEl = codeEl.parentElement;
const graphDefinition = codeEl.textContent;
const graphEl = document.createElement("div");
const graphId = "mermaid-graph-" + id++;
mermaid.render(graphId, graphDefinition).then(({svg, bindFunctions}) => {
graphEl.innerHTML = svg;
bindFunctions?.(graphEl);
preEl.insertAdjacentElement("afterend", graphEl);
preEl.remove();
});
}
});
</script>
"""
end
def before_closing_body_tag(_), do: ""
defp aliases do
[docs: ["docs", ©_images/1]]
end
defp copy_images(_) do
File.mkdir_p("doc/files/")
File.cp!("pages/cookbook/files/shopify-screenshot.png", "doc/files/shopify-screenshot.png")
end
# Run "mix help deps" to learn about dependencies.
defp deps do
[
{:ecto, "~> 3.12"},
{:jason, "~> 1.4.0"},
{:req, "~> 0.5 or ~> 1.0"},
{:jaxon, "~> 2.0"},
{:ex_doc, "~> 0.31", only: :dev, runtime: false},
{:mox, "~> 1.1.0", only: :test},
{:phoenix, "~> 1.7", only: :test},
{:phoenix_live_view, "~> 0.20.17", only: :test}
]
end
end