casedev 0.1.0__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.
- casedev/__init__.py +104 -0
- casedev/_base_client.py +1995 -0
- casedev/_client.py +560 -0
- casedev/_compat.py +219 -0
- casedev/_constants.py +14 -0
- casedev/_exceptions.py +108 -0
- casedev/_files.py +123 -0
- casedev/_models.py +857 -0
- casedev/_qs.py +150 -0
- casedev/_resource.py +43 -0
- casedev/_response.py +830 -0
- casedev/_streaming.py +333 -0
- casedev/_types.py +260 -0
- casedev/_utils/__init__.py +64 -0
- casedev/_utils/_compat.py +45 -0
- casedev/_utils/_datetime_parse.py +136 -0
- casedev/_utils/_logs.py +25 -0
- casedev/_utils/_proxy.py +65 -0
- casedev/_utils/_reflection.py +42 -0
- casedev/_utils/_resources_proxy.py +24 -0
- casedev/_utils/_streams.py +12 -0
- casedev/_utils/_sync.py +58 -0
- casedev/_utils/_transform.py +457 -0
- casedev/_utils/_typing.py +156 -0
- casedev/_utils/_utils.py +421 -0
- casedev/_version.py +4 -0
- casedev/lib/.keep +4 -0
- casedev/py.typed +0 -0
- casedev/resources/__init__.py +173 -0
- casedev/resources/actions/__init__.py +33 -0
- casedev/resources/actions/actions.py +102 -0
- casedev/resources/actions/v1.py +640 -0
- casedev/resources/compute/__init__.py +33 -0
- casedev/resources/compute/compute.py +102 -0
- casedev/resources/compute/v1/__init__.py +89 -0
- casedev/resources/compute/v1/environments.py +492 -0
- casedev/resources/compute/v1/functions.py +278 -0
- casedev/resources/compute/v1/invoke.py +216 -0
- casedev/resources/compute/v1/runs.py +290 -0
- casedev/resources/compute/v1/secrets.py +655 -0
- casedev/resources/compute/v1/v1.py +583 -0
- casedev/resources/convert/__init__.py +33 -0
- casedev/resources/convert/convert.py +102 -0
- casedev/resources/convert/v1/__init__.py +33 -0
- casedev/resources/convert/v1/jobs.py +254 -0
- casedev/resources/convert/v1/v1.py +450 -0
- casedev/resources/format/__init__.py +33 -0
- casedev/resources/format/format.py +102 -0
- casedev/resources/format/v1/__init__.py +33 -0
- casedev/resources/format/v1/templates.py +419 -0
- casedev/resources/format/v1/v1.py +244 -0
- casedev/resources/llm/__init__.py +33 -0
- casedev/resources/llm/llm.py +192 -0
- casedev/resources/llm/v1/__init__.py +33 -0
- casedev/resources/llm/v1/chat.py +243 -0
- casedev/resources/llm/v1/v1.py +317 -0
- casedev/resources/ocr/__init__.py +33 -0
- casedev/resources/ocr/ocr.py +102 -0
- casedev/resources/ocr/v1.py +407 -0
- casedev/resources/search/__init__.py +33 -0
- casedev/resources/search/search.py +102 -0
- casedev/resources/search/v1.py +1052 -0
- casedev/resources/templates/__init__.py +33 -0
- casedev/resources/templates/templates.py +102 -0
- casedev/resources/templates/v1.py +633 -0
- casedev/resources/vault/__init__.py +47 -0
- casedev/resources/vault/graphrag.py +256 -0
- casedev/resources/vault/objects.py +571 -0
- casedev/resources/vault/vault.py +764 -0
- casedev/resources/voice/__init__.py +61 -0
- casedev/resources/voice/streaming.py +160 -0
- casedev/resources/voice/transcription.py +327 -0
- casedev/resources/voice/v1/__init__.py +33 -0
- casedev/resources/voice/v1/speak.py +478 -0
- casedev/resources/voice/v1/v1.py +290 -0
- casedev/resources/voice/voice.py +166 -0
- casedev/resources/webhooks/__init__.py +33 -0
- casedev/resources/webhooks/v1.py +447 -0
- casedev/resources/webhooks/webhooks.py +102 -0
- casedev/resources/workflows/__init__.py +33 -0
- casedev/resources/workflows/v1.py +1053 -0
- casedev/resources/workflows/workflows.py +102 -0
- casedev/types/__init__.py +12 -0
- casedev/types/actions/__init__.py +8 -0
- casedev/types/actions/v1_create_params.py +22 -0
- casedev/types/actions/v1_create_response.py +33 -0
- casedev/types/actions/v1_execute_params.py +16 -0
- casedev/types/actions/v1_execute_response.py +31 -0
- casedev/types/compute/__init__.py +7 -0
- casedev/types/compute/v1/__init__.py +18 -0
- casedev/types/compute/v1/environment_create_params.py +12 -0
- casedev/types/compute/v1/environment_create_response.py +34 -0
- casedev/types/compute/v1/environment_delete_response.py +11 -0
- casedev/types/compute/v1/function_get_logs_params.py +12 -0
- casedev/types/compute/v1/function_list_params.py +12 -0
- casedev/types/compute/v1/invoke_run_params.py +21 -0
- casedev/types/compute/v1/invoke_run_response.py +39 -0
- casedev/types/compute/v1/run_list_params.py +18 -0
- casedev/types/compute/v1/secret_create_params.py +24 -0
- casedev/types/compute/v1/secret_create_response.py +24 -0
- casedev/types/compute/v1/secret_delete_group_params.py +18 -0
- casedev/types/compute/v1/secret_list_params.py +15 -0
- casedev/types/compute/v1/secret_retrieve_group_params.py +12 -0
- casedev/types/compute/v1/secret_update_group_params.py +16 -0
- casedev/types/compute/v1_deploy_params.py +114 -0
- casedev/types/compute/v1_deploy_response.py +30 -0
- casedev/types/compute/v1_get_usage_params.py +15 -0
- casedev/types/convert/__init__.py +8 -0
- casedev/types/convert/v1/__init__.py +3 -0
- casedev/types/convert/v1_process_params.py +15 -0
- casedev/types/convert/v1_process_response.py +19 -0
- casedev/types/convert/v1_webhook_params.py +32 -0
- casedev/types/convert/v1_webhook_response.py +13 -0
- casedev/types/format/__init__.py +5 -0
- casedev/types/format/v1/__init__.py +7 -0
- casedev/types/format/v1/template_create_params.py +32 -0
- casedev/types/format/v1/template_create_response.py +27 -0
- casedev/types/format/v1/template_list_params.py +12 -0
- casedev/types/format/v1_create_document_params.py +42 -0
- casedev/types/llm/__init__.py +5 -0
- casedev/types/llm/v1/__init__.py +6 -0
- casedev/types/llm/v1/chat_create_completion_params.py +42 -0
- casedev/types/llm/v1/chat_create_completion_response.py +49 -0
- casedev/types/llm/v1_create_embedding_params.py +27 -0
- casedev/types/ocr/__init__.py +6 -0
- casedev/types/ocr/v1_process_params.py +44 -0
- casedev/types/ocr/v1_process_response.py +32 -0
- casedev/types/search/__init__.py +15 -0
- casedev/types/search/v1_answer_params.py +45 -0
- casedev/types/search/v1_answer_response.py +35 -0
- casedev/types/search/v1_contents_params.py +42 -0
- casedev/types/search/v1_contents_response.py +31 -0
- casedev/types/search/v1_research_params.py +23 -0
- casedev/types/search/v1_research_response.py +20 -0
- casedev/types/search/v1_retrieve_research_params.py +15 -0
- casedev/types/search/v1_search_params.py +56 -0
- casedev/types/search/v1_search_response.py +38 -0
- casedev/types/search/v1_similar_params.py +44 -0
- casedev/types/search/v1_similar_response.py +33 -0
- casedev/types/templates/__init__.py +8 -0
- casedev/types/templates/v1_execute_params.py +22 -0
- casedev/types/templates/v1_execute_response.py +31 -0
- casedev/types/templates/v1_list_params.py +32 -0
- casedev/types/templates/v1_search_params.py +18 -0
- casedev/types/vault/__init__.py +6 -0
- casedev/types/vault/object_create_presigned_url_params.py +22 -0
- casedev/types/vault/object_create_presigned_url_response.py +51 -0
- casedev/types/vault_create_params.py +20 -0
- casedev/types/vault_create_response.py +36 -0
- casedev/types/vault_ingest_response.py +26 -0
- casedev/types/vault_list_response.py +40 -0
- casedev/types/vault_search_params.py +27 -0
- casedev/types/vault_search_response.py +53 -0
- casedev/types/vault_upload_params.py +26 -0
- casedev/types/vault_upload_response.py +39 -0
- casedev/types/voice/__init__.py +7 -0
- casedev/types/voice/transcription_create_params.py +36 -0
- casedev/types/voice/transcription_retrieve_response.py +41 -0
- casedev/types/voice/v1/__init__.py +6 -0
- casedev/types/voice/v1/speak_create_params.py +59 -0
- casedev/types/voice/v1/speak_stream_params.py +58 -0
- casedev/types/voice/v1_list_voices_params.py +36 -0
- casedev/types/webhooks/__init__.py +6 -0
- casedev/types/webhooks/v1_create_params.py +20 -0
- casedev/types/webhooks/v1_create_response.py +33 -0
- casedev/types/workflows/__init__.py +19 -0
- casedev/types/workflows/v1_create_params.py +32 -0
- casedev/types/workflows/v1_create_response.py +29 -0
- casedev/types/workflows/v1_delete_response.py +13 -0
- casedev/types/workflows/v1_deploy_response.py +20 -0
- casedev/types/workflows/v1_execute_params.py +12 -0
- casedev/types/workflows/v1_execute_response.py +22 -0
- casedev/types/workflows/v1_list_executions_params.py +13 -0
- casedev/types/workflows/v1_list_executions_response.py +27 -0
- casedev/types/workflows/v1_list_params.py +18 -0
- casedev/types/workflows/v1_list_response.py +37 -0
- casedev/types/workflows/v1_retrieve_execution_response.py +31 -0
- casedev/types/workflows/v1_retrieve_response.py +35 -0
- casedev/types/workflows/v1_undeploy_response.py +13 -0
- casedev/types/workflows/v1_update_params.py +26 -0
- casedev/types/workflows/v1_update_response.py +17 -0
- casedev-0.1.0.dist-info/METADATA +454 -0
- casedev-0.1.0.dist-info/RECORD +185 -0
- casedev-0.1.0.dist-info/WHEEL +4 -0
- casedev-0.1.0.dist-info/licenses/LICENSE +201 -0
|
@@ -0,0 +1,1052 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Union
|
|
6
|
+
from datetime import date
|
|
7
|
+
from typing_extensions import Literal
|
|
8
|
+
|
|
9
|
+
import httpx
|
|
10
|
+
|
|
11
|
+
from ..._types import Body, Omit, Query, Headers, NoneType, NotGiven, SequenceNotStr, omit, not_given
|
|
12
|
+
from ..._utils import maybe_transform, async_maybe_transform
|
|
13
|
+
from ..._compat import cached_property
|
|
14
|
+
from ..._resource import SyncAPIResource, AsyncAPIResource
|
|
15
|
+
from ..._response import (
|
|
16
|
+
to_raw_response_wrapper,
|
|
17
|
+
to_streamed_response_wrapper,
|
|
18
|
+
async_to_raw_response_wrapper,
|
|
19
|
+
async_to_streamed_response_wrapper,
|
|
20
|
+
)
|
|
21
|
+
from ..._base_client import make_request_options
|
|
22
|
+
from ...types.search import (
|
|
23
|
+
v1_answer_params,
|
|
24
|
+
v1_search_params,
|
|
25
|
+
v1_similar_params,
|
|
26
|
+
v1_contents_params,
|
|
27
|
+
v1_research_params,
|
|
28
|
+
v1_retrieve_research_params,
|
|
29
|
+
)
|
|
30
|
+
from ...types.search.v1_answer_response import V1AnswerResponse
|
|
31
|
+
from ...types.search.v1_search_response import V1SearchResponse
|
|
32
|
+
from ...types.search.v1_similar_response import V1SimilarResponse
|
|
33
|
+
from ...types.search.v1_contents_response import V1ContentsResponse
|
|
34
|
+
from ...types.search.v1_research_response import V1ResearchResponse
|
|
35
|
+
|
|
36
|
+
__all__ = ["V1Resource", "AsyncV1Resource"]
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
class V1Resource(SyncAPIResource):
|
|
40
|
+
@cached_property
|
|
41
|
+
def with_raw_response(self) -> V1ResourceWithRawResponse:
|
|
42
|
+
"""
|
|
43
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
44
|
+
the raw response object instead of the parsed content.
|
|
45
|
+
|
|
46
|
+
For more information, see https://www.github.com/CaseMark/casedev-python#accessing-raw-response-data-eg-headers
|
|
47
|
+
"""
|
|
48
|
+
return V1ResourceWithRawResponse(self)
|
|
49
|
+
|
|
50
|
+
@cached_property
|
|
51
|
+
def with_streaming_response(self) -> V1ResourceWithStreamingResponse:
|
|
52
|
+
"""
|
|
53
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
54
|
+
|
|
55
|
+
For more information, see https://www.github.com/CaseMark/casedev-python#with_streaming_response
|
|
56
|
+
"""
|
|
57
|
+
return V1ResourceWithStreamingResponse(self)
|
|
58
|
+
|
|
59
|
+
def answer(
|
|
60
|
+
self,
|
|
61
|
+
*,
|
|
62
|
+
query: str,
|
|
63
|
+
exclude_domains: SequenceNotStr[str] | Omit = omit,
|
|
64
|
+
include_domains: SequenceNotStr[str] | Omit = omit,
|
|
65
|
+
max_tokens: int | Omit = omit,
|
|
66
|
+
model: str | Omit = omit,
|
|
67
|
+
num_results: int | Omit = omit,
|
|
68
|
+
search_type: Literal["auto", "web", "news", "academic"] | Omit = omit,
|
|
69
|
+
stream: bool | Omit = omit,
|
|
70
|
+
temperature: float | Omit = omit,
|
|
71
|
+
text: bool | Omit = omit,
|
|
72
|
+
use_custom_llm: bool | Omit = omit,
|
|
73
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
74
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
75
|
+
extra_headers: Headers | None = None,
|
|
76
|
+
extra_query: Query | None = None,
|
|
77
|
+
extra_body: Body | None = None,
|
|
78
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
79
|
+
) -> V1AnswerResponse:
|
|
80
|
+
"""Generate comprehensive answers to questions using web search results.
|
|
81
|
+
|
|
82
|
+
Supports
|
|
83
|
+
two modes: native provider answers or custom LLM-powered answers using
|
|
84
|
+
Case.dev's AI gateway. Perfect for legal research, fact-checking, and gathering
|
|
85
|
+
supporting evidence for cases.
|
|
86
|
+
|
|
87
|
+
Args:
|
|
88
|
+
query: The question or topic to research and answer
|
|
89
|
+
|
|
90
|
+
exclude_domains: Exclude these domains from search
|
|
91
|
+
|
|
92
|
+
include_domains: Only search within these domains
|
|
93
|
+
|
|
94
|
+
max_tokens: Maximum tokens for LLM response
|
|
95
|
+
|
|
96
|
+
model: LLM model to use when useCustomLLM is true
|
|
97
|
+
|
|
98
|
+
num_results: Number of search results to consider
|
|
99
|
+
|
|
100
|
+
search_type: Type of search to perform
|
|
101
|
+
|
|
102
|
+
stream: Stream the response (only for native provider answers)
|
|
103
|
+
|
|
104
|
+
temperature: LLM temperature for answer generation
|
|
105
|
+
|
|
106
|
+
text: Include text content in response
|
|
107
|
+
|
|
108
|
+
use_custom_llm: Use Case.dev LLM for answer generation instead of provider's native answer
|
|
109
|
+
|
|
110
|
+
extra_headers: Send extra headers
|
|
111
|
+
|
|
112
|
+
extra_query: Add additional query parameters to the request
|
|
113
|
+
|
|
114
|
+
extra_body: Add additional JSON properties to the request
|
|
115
|
+
|
|
116
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
117
|
+
"""
|
|
118
|
+
return self._post(
|
|
119
|
+
"/search/v1/answer",
|
|
120
|
+
body=maybe_transform(
|
|
121
|
+
{
|
|
122
|
+
"query": query,
|
|
123
|
+
"exclude_domains": exclude_domains,
|
|
124
|
+
"include_domains": include_domains,
|
|
125
|
+
"max_tokens": max_tokens,
|
|
126
|
+
"model": model,
|
|
127
|
+
"num_results": num_results,
|
|
128
|
+
"search_type": search_type,
|
|
129
|
+
"stream": stream,
|
|
130
|
+
"temperature": temperature,
|
|
131
|
+
"text": text,
|
|
132
|
+
"use_custom_llm": use_custom_llm,
|
|
133
|
+
},
|
|
134
|
+
v1_answer_params.V1AnswerParams,
|
|
135
|
+
),
|
|
136
|
+
options=make_request_options(
|
|
137
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
138
|
+
),
|
|
139
|
+
cast_to=V1AnswerResponse,
|
|
140
|
+
)
|
|
141
|
+
|
|
142
|
+
def contents(
|
|
143
|
+
self,
|
|
144
|
+
*,
|
|
145
|
+
urls: SequenceNotStr[str],
|
|
146
|
+
context: str | Omit = omit,
|
|
147
|
+
extras: object | Omit = omit,
|
|
148
|
+
highlights: bool | Omit = omit,
|
|
149
|
+
livecrawl: bool | Omit = omit,
|
|
150
|
+
livecrawl_timeout: int | Omit = omit,
|
|
151
|
+
subpages: bool | Omit = omit,
|
|
152
|
+
subpage_target: int | Omit = omit,
|
|
153
|
+
summary: bool | Omit = omit,
|
|
154
|
+
text: bool | Omit = omit,
|
|
155
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
156
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
157
|
+
extra_headers: Headers | None = None,
|
|
158
|
+
extra_query: Query | None = None,
|
|
159
|
+
extra_body: Body | None = None,
|
|
160
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
161
|
+
) -> V1ContentsResponse:
|
|
162
|
+
"""Scrapes and extracts text content from web pages, PDFs, and documents.
|
|
163
|
+
|
|
164
|
+
Useful
|
|
165
|
+
for legal research, evidence collection, and document analysis. Supports live
|
|
166
|
+
crawling, subpage extraction, and content summarization.
|
|
167
|
+
|
|
168
|
+
Args:
|
|
169
|
+
urls: Array of URLs to scrape and extract content from
|
|
170
|
+
|
|
171
|
+
context: Context to guide content extraction and summarization
|
|
172
|
+
|
|
173
|
+
extras: Additional extraction options
|
|
174
|
+
|
|
175
|
+
highlights: Whether to include content highlights
|
|
176
|
+
|
|
177
|
+
livecrawl: Whether to perform live crawling for dynamic content
|
|
178
|
+
|
|
179
|
+
livecrawl_timeout: Timeout in seconds for live crawling
|
|
180
|
+
|
|
181
|
+
subpages: Whether to extract content from linked subpages
|
|
182
|
+
|
|
183
|
+
subpage_target: Maximum number of subpages to crawl
|
|
184
|
+
|
|
185
|
+
summary: Whether to generate content summaries
|
|
186
|
+
|
|
187
|
+
text: Whether to extract text content
|
|
188
|
+
|
|
189
|
+
extra_headers: Send extra headers
|
|
190
|
+
|
|
191
|
+
extra_query: Add additional query parameters to the request
|
|
192
|
+
|
|
193
|
+
extra_body: Add additional JSON properties to the request
|
|
194
|
+
|
|
195
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
196
|
+
"""
|
|
197
|
+
return self._post(
|
|
198
|
+
"/search/v1/contents",
|
|
199
|
+
body=maybe_transform(
|
|
200
|
+
{
|
|
201
|
+
"urls": urls,
|
|
202
|
+
"context": context,
|
|
203
|
+
"extras": extras,
|
|
204
|
+
"highlights": highlights,
|
|
205
|
+
"livecrawl": livecrawl,
|
|
206
|
+
"livecrawl_timeout": livecrawl_timeout,
|
|
207
|
+
"subpages": subpages,
|
|
208
|
+
"subpage_target": subpage_target,
|
|
209
|
+
"summary": summary,
|
|
210
|
+
"text": text,
|
|
211
|
+
},
|
|
212
|
+
v1_contents_params.V1ContentsParams,
|
|
213
|
+
),
|
|
214
|
+
options=make_request_options(
|
|
215
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
216
|
+
),
|
|
217
|
+
cast_to=V1ContentsResponse,
|
|
218
|
+
)
|
|
219
|
+
|
|
220
|
+
def research(
|
|
221
|
+
self,
|
|
222
|
+
*,
|
|
223
|
+
instructions: str,
|
|
224
|
+
model: Literal["fast", "normal", "pro"] | Omit = omit,
|
|
225
|
+
output_schema: object | Omit = omit,
|
|
226
|
+
query: str | Omit = omit,
|
|
227
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
228
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
229
|
+
extra_headers: Headers | None = None,
|
|
230
|
+
extra_query: Query | None = None,
|
|
231
|
+
extra_body: Body | None = None,
|
|
232
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
233
|
+
) -> V1ResearchResponse:
|
|
234
|
+
"""
|
|
235
|
+
Performs deep research by conducting multi-step analysis, gathering information
|
|
236
|
+
from multiple sources, and providing comprehensive insights. Ideal for legal
|
|
237
|
+
research, case analysis, and due diligence investigations.
|
|
238
|
+
|
|
239
|
+
Args:
|
|
240
|
+
instructions: Research instructions or query
|
|
241
|
+
|
|
242
|
+
model: Research quality level - fast (quick), normal (balanced), pro (comprehensive)
|
|
243
|
+
|
|
244
|
+
output_schema: Optional JSON schema to structure the research output
|
|
245
|
+
|
|
246
|
+
query: Alias for instructions (for convenience)
|
|
247
|
+
|
|
248
|
+
extra_headers: Send extra headers
|
|
249
|
+
|
|
250
|
+
extra_query: Add additional query parameters to the request
|
|
251
|
+
|
|
252
|
+
extra_body: Add additional JSON properties to the request
|
|
253
|
+
|
|
254
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
255
|
+
"""
|
|
256
|
+
return self._post(
|
|
257
|
+
"/search/v1/research",
|
|
258
|
+
body=maybe_transform(
|
|
259
|
+
{
|
|
260
|
+
"instructions": instructions,
|
|
261
|
+
"model": model,
|
|
262
|
+
"output_schema": output_schema,
|
|
263
|
+
"query": query,
|
|
264
|
+
},
|
|
265
|
+
v1_research_params.V1ResearchParams,
|
|
266
|
+
),
|
|
267
|
+
options=make_request_options(
|
|
268
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
269
|
+
),
|
|
270
|
+
cast_to=V1ResearchResponse,
|
|
271
|
+
)
|
|
272
|
+
|
|
273
|
+
def retrieve_research(
|
|
274
|
+
self,
|
|
275
|
+
id: str,
|
|
276
|
+
*,
|
|
277
|
+
events: str | Omit = omit,
|
|
278
|
+
stream: bool | Omit = omit,
|
|
279
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
280
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
281
|
+
extra_headers: Headers | None = None,
|
|
282
|
+
extra_query: Query | None = None,
|
|
283
|
+
extra_body: Body | None = None,
|
|
284
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
285
|
+
) -> None:
|
|
286
|
+
"""Retrieve the status and results of a deep research task by ID.
|
|
287
|
+
|
|
288
|
+
Supports both
|
|
289
|
+
standard JSON responses and streaming for real-time updates as the research
|
|
290
|
+
progresses. Research tasks analyze topics comprehensively using web search and
|
|
291
|
+
AI synthesis.
|
|
292
|
+
|
|
293
|
+
Args:
|
|
294
|
+
events: Filter specific event types for streaming
|
|
295
|
+
|
|
296
|
+
stream: Enable streaming for real-time updates
|
|
297
|
+
|
|
298
|
+
extra_headers: Send extra headers
|
|
299
|
+
|
|
300
|
+
extra_query: Add additional query parameters to the request
|
|
301
|
+
|
|
302
|
+
extra_body: Add additional JSON properties to the request
|
|
303
|
+
|
|
304
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
305
|
+
"""
|
|
306
|
+
if not id:
|
|
307
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
308
|
+
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
|
|
309
|
+
return self._get(
|
|
310
|
+
f"/search/v1/research/{id}",
|
|
311
|
+
options=make_request_options(
|
|
312
|
+
extra_headers=extra_headers,
|
|
313
|
+
extra_query=extra_query,
|
|
314
|
+
extra_body=extra_body,
|
|
315
|
+
timeout=timeout,
|
|
316
|
+
query=maybe_transform(
|
|
317
|
+
{
|
|
318
|
+
"events": events,
|
|
319
|
+
"stream": stream,
|
|
320
|
+
},
|
|
321
|
+
v1_retrieve_research_params.V1RetrieveResearchParams,
|
|
322
|
+
),
|
|
323
|
+
),
|
|
324
|
+
cast_to=NoneType,
|
|
325
|
+
)
|
|
326
|
+
|
|
327
|
+
def search(
|
|
328
|
+
self,
|
|
329
|
+
*,
|
|
330
|
+
query: str,
|
|
331
|
+
additional_queries: SequenceNotStr[str] | Omit = omit,
|
|
332
|
+
category: str | Omit = omit,
|
|
333
|
+
contents: str | Omit = omit,
|
|
334
|
+
end_crawl_date: Union[str, date] | Omit = omit,
|
|
335
|
+
end_published_date: Union[str, date] | Omit = omit,
|
|
336
|
+
exclude_domains: SequenceNotStr[str] | Omit = omit,
|
|
337
|
+
include_domains: SequenceNotStr[str] | Omit = omit,
|
|
338
|
+
include_text: bool | Omit = omit,
|
|
339
|
+
num_results: int | Omit = omit,
|
|
340
|
+
start_crawl_date: Union[str, date] | Omit = omit,
|
|
341
|
+
start_published_date: Union[str, date] | Omit = omit,
|
|
342
|
+
type: Literal["auto", "search", "news"] | Omit = omit,
|
|
343
|
+
user_location: str | Omit = omit,
|
|
344
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
345
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
346
|
+
extra_headers: Headers | None = None,
|
|
347
|
+
extra_query: Query | None = None,
|
|
348
|
+
extra_body: Body | None = None,
|
|
349
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
350
|
+
) -> V1SearchResponse:
|
|
351
|
+
"""
|
|
352
|
+
Executes intelligent web search queries with advanced filtering and
|
|
353
|
+
customization options. Ideal for legal research, case law discovery, and
|
|
354
|
+
gathering supporting documentation for litigation or compliance matters.
|
|
355
|
+
|
|
356
|
+
Args:
|
|
357
|
+
query: Primary search query
|
|
358
|
+
|
|
359
|
+
additional_queries: Additional related search queries to enhance results
|
|
360
|
+
|
|
361
|
+
category: Category filter for search results
|
|
362
|
+
|
|
363
|
+
contents: Specific content type to search for
|
|
364
|
+
|
|
365
|
+
end_crawl_date: End date for crawl date filtering
|
|
366
|
+
|
|
367
|
+
end_published_date: End date for published date filtering
|
|
368
|
+
|
|
369
|
+
exclude_domains: Domains to exclude from search results
|
|
370
|
+
|
|
371
|
+
include_domains: Domains to include in search results
|
|
372
|
+
|
|
373
|
+
include_text: Whether to include full text content in results
|
|
374
|
+
|
|
375
|
+
num_results: Number of search results to return
|
|
376
|
+
|
|
377
|
+
start_crawl_date: Start date for crawl date filtering
|
|
378
|
+
|
|
379
|
+
start_published_date: Start date for published date filtering
|
|
380
|
+
|
|
381
|
+
type: Type of search to perform
|
|
382
|
+
|
|
383
|
+
user_location: Geographic location for localized results
|
|
384
|
+
|
|
385
|
+
extra_headers: Send extra headers
|
|
386
|
+
|
|
387
|
+
extra_query: Add additional query parameters to the request
|
|
388
|
+
|
|
389
|
+
extra_body: Add additional JSON properties to the request
|
|
390
|
+
|
|
391
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
392
|
+
"""
|
|
393
|
+
return self._post(
|
|
394
|
+
"/search/v1/search",
|
|
395
|
+
body=maybe_transform(
|
|
396
|
+
{
|
|
397
|
+
"query": query,
|
|
398
|
+
"additional_queries": additional_queries,
|
|
399
|
+
"category": category,
|
|
400
|
+
"contents": contents,
|
|
401
|
+
"end_crawl_date": end_crawl_date,
|
|
402
|
+
"end_published_date": end_published_date,
|
|
403
|
+
"exclude_domains": exclude_domains,
|
|
404
|
+
"include_domains": include_domains,
|
|
405
|
+
"include_text": include_text,
|
|
406
|
+
"num_results": num_results,
|
|
407
|
+
"start_crawl_date": start_crawl_date,
|
|
408
|
+
"start_published_date": start_published_date,
|
|
409
|
+
"type": type,
|
|
410
|
+
"user_location": user_location,
|
|
411
|
+
},
|
|
412
|
+
v1_search_params.V1SearchParams,
|
|
413
|
+
),
|
|
414
|
+
options=make_request_options(
|
|
415
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
416
|
+
),
|
|
417
|
+
cast_to=V1SearchResponse,
|
|
418
|
+
)
|
|
419
|
+
|
|
420
|
+
def similar(
|
|
421
|
+
self,
|
|
422
|
+
*,
|
|
423
|
+
url: str,
|
|
424
|
+
contents: str | Omit = omit,
|
|
425
|
+
end_crawl_date: Union[str, date] | Omit = omit,
|
|
426
|
+
end_published_date: Union[str, date] | Omit = omit,
|
|
427
|
+
exclude_domains: SequenceNotStr[str] | Omit = omit,
|
|
428
|
+
include_domains: SequenceNotStr[str] | Omit = omit,
|
|
429
|
+
include_text: bool | Omit = omit,
|
|
430
|
+
num_results: int | Omit = omit,
|
|
431
|
+
start_crawl_date: Union[str, date] | Omit = omit,
|
|
432
|
+
start_published_date: Union[str, date] | Omit = omit,
|
|
433
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
434
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
435
|
+
extra_headers: Headers | None = None,
|
|
436
|
+
extra_query: Query | None = None,
|
|
437
|
+
extra_body: Body | None = None,
|
|
438
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
439
|
+
) -> V1SimilarResponse:
|
|
440
|
+
"""Find web pages and documents similar to a given URL.
|
|
441
|
+
|
|
442
|
+
Useful for legal research
|
|
443
|
+
to discover related case law, statutes, or legal commentary that shares similar
|
|
444
|
+
themes or content structure.
|
|
445
|
+
|
|
446
|
+
Args:
|
|
447
|
+
url: The URL to find similar content for
|
|
448
|
+
|
|
449
|
+
contents: Additional content to consider for similarity matching
|
|
450
|
+
|
|
451
|
+
end_crawl_date: Only include pages crawled before this date
|
|
452
|
+
|
|
453
|
+
end_published_date: Only include pages published before this date
|
|
454
|
+
|
|
455
|
+
exclude_domains: Exclude results from these domains
|
|
456
|
+
|
|
457
|
+
include_domains: Only search within these domains
|
|
458
|
+
|
|
459
|
+
include_text: Whether to include extracted text content in results
|
|
460
|
+
|
|
461
|
+
num_results: Number of similar results to return
|
|
462
|
+
|
|
463
|
+
start_crawl_date: Only include pages crawled after this date
|
|
464
|
+
|
|
465
|
+
start_published_date: Only include pages published after this date
|
|
466
|
+
|
|
467
|
+
extra_headers: Send extra headers
|
|
468
|
+
|
|
469
|
+
extra_query: Add additional query parameters to the request
|
|
470
|
+
|
|
471
|
+
extra_body: Add additional JSON properties to the request
|
|
472
|
+
|
|
473
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
474
|
+
"""
|
|
475
|
+
return self._post(
|
|
476
|
+
"/search/v1/similar",
|
|
477
|
+
body=maybe_transform(
|
|
478
|
+
{
|
|
479
|
+
"url": url,
|
|
480
|
+
"contents": contents,
|
|
481
|
+
"end_crawl_date": end_crawl_date,
|
|
482
|
+
"end_published_date": end_published_date,
|
|
483
|
+
"exclude_domains": exclude_domains,
|
|
484
|
+
"include_domains": include_domains,
|
|
485
|
+
"include_text": include_text,
|
|
486
|
+
"num_results": num_results,
|
|
487
|
+
"start_crawl_date": start_crawl_date,
|
|
488
|
+
"start_published_date": start_published_date,
|
|
489
|
+
},
|
|
490
|
+
v1_similar_params.V1SimilarParams,
|
|
491
|
+
),
|
|
492
|
+
options=make_request_options(
|
|
493
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
494
|
+
),
|
|
495
|
+
cast_to=V1SimilarResponse,
|
|
496
|
+
)
|
|
497
|
+
|
|
498
|
+
|
|
499
|
+
class AsyncV1Resource(AsyncAPIResource):
|
|
500
|
+
@cached_property
|
|
501
|
+
def with_raw_response(self) -> AsyncV1ResourceWithRawResponse:
|
|
502
|
+
"""
|
|
503
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
504
|
+
the raw response object instead of the parsed content.
|
|
505
|
+
|
|
506
|
+
For more information, see https://www.github.com/CaseMark/casedev-python#accessing-raw-response-data-eg-headers
|
|
507
|
+
"""
|
|
508
|
+
return AsyncV1ResourceWithRawResponse(self)
|
|
509
|
+
|
|
510
|
+
@cached_property
|
|
511
|
+
def with_streaming_response(self) -> AsyncV1ResourceWithStreamingResponse:
|
|
512
|
+
"""
|
|
513
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
514
|
+
|
|
515
|
+
For more information, see https://www.github.com/CaseMark/casedev-python#with_streaming_response
|
|
516
|
+
"""
|
|
517
|
+
return AsyncV1ResourceWithStreamingResponse(self)
|
|
518
|
+
|
|
519
|
+
async def answer(
|
|
520
|
+
self,
|
|
521
|
+
*,
|
|
522
|
+
query: str,
|
|
523
|
+
exclude_domains: SequenceNotStr[str] | Omit = omit,
|
|
524
|
+
include_domains: SequenceNotStr[str] | Omit = omit,
|
|
525
|
+
max_tokens: int | Omit = omit,
|
|
526
|
+
model: str | Omit = omit,
|
|
527
|
+
num_results: int | Omit = omit,
|
|
528
|
+
search_type: Literal["auto", "web", "news", "academic"] | Omit = omit,
|
|
529
|
+
stream: bool | Omit = omit,
|
|
530
|
+
temperature: float | Omit = omit,
|
|
531
|
+
text: bool | Omit = omit,
|
|
532
|
+
use_custom_llm: bool | Omit = omit,
|
|
533
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
534
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
535
|
+
extra_headers: Headers | None = None,
|
|
536
|
+
extra_query: Query | None = None,
|
|
537
|
+
extra_body: Body | None = None,
|
|
538
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
539
|
+
) -> V1AnswerResponse:
|
|
540
|
+
"""Generate comprehensive answers to questions using web search results.
|
|
541
|
+
|
|
542
|
+
Supports
|
|
543
|
+
two modes: native provider answers or custom LLM-powered answers using
|
|
544
|
+
Case.dev's AI gateway. Perfect for legal research, fact-checking, and gathering
|
|
545
|
+
supporting evidence for cases.
|
|
546
|
+
|
|
547
|
+
Args:
|
|
548
|
+
query: The question or topic to research and answer
|
|
549
|
+
|
|
550
|
+
exclude_domains: Exclude these domains from search
|
|
551
|
+
|
|
552
|
+
include_domains: Only search within these domains
|
|
553
|
+
|
|
554
|
+
max_tokens: Maximum tokens for LLM response
|
|
555
|
+
|
|
556
|
+
model: LLM model to use when useCustomLLM is true
|
|
557
|
+
|
|
558
|
+
num_results: Number of search results to consider
|
|
559
|
+
|
|
560
|
+
search_type: Type of search to perform
|
|
561
|
+
|
|
562
|
+
stream: Stream the response (only for native provider answers)
|
|
563
|
+
|
|
564
|
+
temperature: LLM temperature for answer generation
|
|
565
|
+
|
|
566
|
+
text: Include text content in response
|
|
567
|
+
|
|
568
|
+
use_custom_llm: Use Case.dev LLM for answer generation instead of provider's native answer
|
|
569
|
+
|
|
570
|
+
extra_headers: Send extra headers
|
|
571
|
+
|
|
572
|
+
extra_query: Add additional query parameters to the request
|
|
573
|
+
|
|
574
|
+
extra_body: Add additional JSON properties to the request
|
|
575
|
+
|
|
576
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
577
|
+
"""
|
|
578
|
+
return await self._post(
|
|
579
|
+
"/search/v1/answer",
|
|
580
|
+
body=await async_maybe_transform(
|
|
581
|
+
{
|
|
582
|
+
"query": query,
|
|
583
|
+
"exclude_domains": exclude_domains,
|
|
584
|
+
"include_domains": include_domains,
|
|
585
|
+
"max_tokens": max_tokens,
|
|
586
|
+
"model": model,
|
|
587
|
+
"num_results": num_results,
|
|
588
|
+
"search_type": search_type,
|
|
589
|
+
"stream": stream,
|
|
590
|
+
"temperature": temperature,
|
|
591
|
+
"text": text,
|
|
592
|
+
"use_custom_llm": use_custom_llm,
|
|
593
|
+
},
|
|
594
|
+
v1_answer_params.V1AnswerParams,
|
|
595
|
+
),
|
|
596
|
+
options=make_request_options(
|
|
597
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
598
|
+
),
|
|
599
|
+
cast_to=V1AnswerResponse,
|
|
600
|
+
)
|
|
601
|
+
|
|
602
|
+
async def contents(
|
|
603
|
+
self,
|
|
604
|
+
*,
|
|
605
|
+
urls: SequenceNotStr[str],
|
|
606
|
+
context: str | Omit = omit,
|
|
607
|
+
extras: object | Omit = omit,
|
|
608
|
+
highlights: bool | Omit = omit,
|
|
609
|
+
livecrawl: bool | Omit = omit,
|
|
610
|
+
livecrawl_timeout: int | Omit = omit,
|
|
611
|
+
subpages: bool | Omit = omit,
|
|
612
|
+
subpage_target: int | Omit = omit,
|
|
613
|
+
summary: bool | Omit = omit,
|
|
614
|
+
text: bool | Omit = omit,
|
|
615
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
616
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
617
|
+
extra_headers: Headers | None = None,
|
|
618
|
+
extra_query: Query | None = None,
|
|
619
|
+
extra_body: Body | None = None,
|
|
620
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
621
|
+
) -> V1ContentsResponse:
|
|
622
|
+
"""Scrapes and extracts text content from web pages, PDFs, and documents.
|
|
623
|
+
|
|
624
|
+
Useful
|
|
625
|
+
for legal research, evidence collection, and document analysis. Supports live
|
|
626
|
+
crawling, subpage extraction, and content summarization.
|
|
627
|
+
|
|
628
|
+
Args:
|
|
629
|
+
urls: Array of URLs to scrape and extract content from
|
|
630
|
+
|
|
631
|
+
context: Context to guide content extraction and summarization
|
|
632
|
+
|
|
633
|
+
extras: Additional extraction options
|
|
634
|
+
|
|
635
|
+
highlights: Whether to include content highlights
|
|
636
|
+
|
|
637
|
+
livecrawl: Whether to perform live crawling for dynamic content
|
|
638
|
+
|
|
639
|
+
livecrawl_timeout: Timeout in seconds for live crawling
|
|
640
|
+
|
|
641
|
+
subpages: Whether to extract content from linked subpages
|
|
642
|
+
|
|
643
|
+
subpage_target: Maximum number of subpages to crawl
|
|
644
|
+
|
|
645
|
+
summary: Whether to generate content summaries
|
|
646
|
+
|
|
647
|
+
text: Whether to extract text content
|
|
648
|
+
|
|
649
|
+
extra_headers: Send extra headers
|
|
650
|
+
|
|
651
|
+
extra_query: Add additional query parameters to the request
|
|
652
|
+
|
|
653
|
+
extra_body: Add additional JSON properties to the request
|
|
654
|
+
|
|
655
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
656
|
+
"""
|
|
657
|
+
return await self._post(
|
|
658
|
+
"/search/v1/contents",
|
|
659
|
+
body=await async_maybe_transform(
|
|
660
|
+
{
|
|
661
|
+
"urls": urls,
|
|
662
|
+
"context": context,
|
|
663
|
+
"extras": extras,
|
|
664
|
+
"highlights": highlights,
|
|
665
|
+
"livecrawl": livecrawl,
|
|
666
|
+
"livecrawl_timeout": livecrawl_timeout,
|
|
667
|
+
"subpages": subpages,
|
|
668
|
+
"subpage_target": subpage_target,
|
|
669
|
+
"summary": summary,
|
|
670
|
+
"text": text,
|
|
671
|
+
},
|
|
672
|
+
v1_contents_params.V1ContentsParams,
|
|
673
|
+
),
|
|
674
|
+
options=make_request_options(
|
|
675
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
676
|
+
),
|
|
677
|
+
cast_to=V1ContentsResponse,
|
|
678
|
+
)
|
|
679
|
+
|
|
680
|
+
async def research(
|
|
681
|
+
self,
|
|
682
|
+
*,
|
|
683
|
+
instructions: str,
|
|
684
|
+
model: Literal["fast", "normal", "pro"] | Omit = omit,
|
|
685
|
+
output_schema: object | Omit = omit,
|
|
686
|
+
query: str | Omit = omit,
|
|
687
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
688
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
689
|
+
extra_headers: Headers | None = None,
|
|
690
|
+
extra_query: Query | None = None,
|
|
691
|
+
extra_body: Body | None = None,
|
|
692
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
693
|
+
) -> V1ResearchResponse:
|
|
694
|
+
"""
|
|
695
|
+
Performs deep research by conducting multi-step analysis, gathering information
|
|
696
|
+
from multiple sources, and providing comprehensive insights. Ideal for legal
|
|
697
|
+
research, case analysis, and due diligence investigations.
|
|
698
|
+
|
|
699
|
+
Args:
|
|
700
|
+
instructions: Research instructions or query
|
|
701
|
+
|
|
702
|
+
model: Research quality level - fast (quick), normal (balanced), pro (comprehensive)
|
|
703
|
+
|
|
704
|
+
output_schema: Optional JSON schema to structure the research output
|
|
705
|
+
|
|
706
|
+
query: Alias for instructions (for convenience)
|
|
707
|
+
|
|
708
|
+
extra_headers: Send extra headers
|
|
709
|
+
|
|
710
|
+
extra_query: Add additional query parameters to the request
|
|
711
|
+
|
|
712
|
+
extra_body: Add additional JSON properties to the request
|
|
713
|
+
|
|
714
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
715
|
+
"""
|
|
716
|
+
return await self._post(
|
|
717
|
+
"/search/v1/research",
|
|
718
|
+
body=await async_maybe_transform(
|
|
719
|
+
{
|
|
720
|
+
"instructions": instructions,
|
|
721
|
+
"model": model,
|
|
722
|
+
"output_schema": output_schema,
|
|
723
|
+
"query": query,
|
|
724
|
+
},
|
|
725
|
+
v1_research_params.V1ResearchParams,
|
|
726
|
+
),
|
|
727
|
+
options=make_request_options(
|
|
728
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
729
|
+
),
|
|
730
|
+
cast_to=V1ResearchResponse,
|
|
731
|
+
)
|
|
732
|
+
|
|
733
|
+
async def retrieve_research(
|
|
734
|
+
self,
|
|
735
|
+
id: str,
|
|
736
|
+
*,
|
|
737
|
+
events: str | Omit = omit,
|
|
738
|
+
stream: bool | Omit = omit,
|
|
739
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
740
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
741
|
+
extra_headers: Headers | None = None,
|
|
742
|
+
extra_query: Query | None = None,
|
|
743
|
+
extra_body: Body | None = None,
|
|
744
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
745
|
+
) -> None:
|
|
746
|
+
"""Retrieve the status and results of a deep research task by ID.
|
|
747
|
+
|
|
748
|
+
Supports both
|
|
749
|
+
standard JSON responses and streaming for real-time updates as the research
|
|
750
|
+
progresses. Research tasks analyze topics comprehensively using web search and
|
|
751
|
+
AI synthesis.
|
|
752
|
+
|
|
753
|
+
Args:
|
|
754
|
+
events: Filter specific event types for streaming
|
|
755
|
+
|
|
756
|
+
stream: Enable streaming for real-time updates
|
|
757
|
+
|
|
758
|
+
extra_headers: Send extra headers
|
|
759
|
+
|
|
760
|
+
extra_query: Add additional query parameters to the request
|
|
761
|
+
|
|
762
|
+
extra_body: Add additional JSON properties to the request
|
|
763
|
+
|
|
764
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
765
|
+
"""
|
|
766
|
+
if not id:
|
|
767
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
768
|
+
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
|
|
769
|
+
return await self._get(
|
|
770
|
+
f"/search/v1/research/{id}",
|
|
771
|
+
options=make_request_options(
|
|
772
|
+
extra_headers=extra_headers,
|
|
773
|
+
extra_query=extra_query,
|
|
774
|
+
extra_body=extra_body,
|
|
775
|
+
timeout=timeout,
|
|
776
|
+
query=await async_maybe_transform(
|
|
777
|
+
{
|
|
778
|
+
"events": events,
|
|
779
|
+
"stream": stream,
|
|
780
|
+
},
|
|
781
|
+
v1_retrieve_research_params.V1RetrieveResearchParams,
|
|
782
|
+
),
|
|
783
|
+
),
|
|
784
|
+
cast_to=NoneType,
|
|
785
|
+
)
|
|
786
|
+
|
|
787
|
+
async def search(
|
|
788
|
+
self,
|
|
789
|
+
*,
|
|
790
|
+
query: str,
|
|
791
|
+
additional_queries: SequenceNotStr[str] | Omit = omit,
|
|
792
|
+
category: str | Omit = omit,
|
|
793
|
+
contents: str | Omit = omit,
|
|
794
|
+
end_crawl_date: Union[str, date] | Omit = omit,
|
|
795
|
+
end_published_date: Union[str, date] | Omit = omit,
|
|
796
|
+
exclude_domains: SequenceNotStr[str] | Omit = omit,
|
|
797
|
+
include_domains: SequenceNotStr[str] | Omit = omit,
|
|
798
|
+
include_text: bool | Omit = omit,
|
|
799
|
+
num_results: int | Omit = omit,
|
|
800
|
+
start_crawl_date: Union[str, date] | Omit = omit,
|
|
801
|
+
start_published_date: Union[str, date] | Omit = omit,
|
|
802
|
+
type: Literal["auto", "search", "news"] | Omit = omit,
|
|
803
|
+
user_location: str | Omit = omit,
|
|
804
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
805
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
806
|
+
extra_headers: Headers | None = None,
|
|
807
|
+
extra_query: Query | None = None,
|
|
808
|
+
extra_body: Body | None = None,
|
|
809
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
810
|
+
) -> V1SearchResponse:
|
|
811
|
+
"""
|
|
812
|
+
Executes intelligent web search queries with advanced filtering and
|
|
813
|
+
customization options. Ideal for legal research, case law discovery, and
|
|
814
|
+
gathering supporting documentation for litigation or compliance matters.
|
|
815
|
+
|
|
816
|
+
Args:
|
|
817
|
+
query: Primary search query
|
|
818
|
+
|
|
819
|
+
additional_queries: Additional related search queries to enhance results
|
|
820
|
+
|
|
821
|
+
category: Category filter for search results
|
|
822
|
+
|
|
823
|
+
contents: Specific content type to search for
|
|
824
|
+
|
|
825
|
+
end_crawl_date: End date for crawl date filtering
|
|
826
|
+
|
|
827
|
+
end_published_date: End date for published date filtering
|
|
828
|
+
|
|
829
|
+
exclude_domains: Domains to exclude from search results
|
|
830
|
+
|
|
831
|
+
include_domains: Domains to include in search results
|
|
832
|
+
|
|
833
|
+
include_text: Whether to include full text content in results
|
|
834
|
+
|
|
835
|
+
num_results: Number of search results to return
|
|
836
|
+
|
|
837
|
+
start_crawl_date: Start date for crawl date filtering
|
|
838
|
+
|
|
839
|
+
start_published_date: Start date for published date filtering
|
|
840
|
+
|
|
841
|
+
type: Type of search to perform
|
|
842
|
+
|
|
843
|
+
user_location: Geographic location for localized results
|
|
844
|
+
|
|
845
|
+
extra_headers: Send extra headers
|
|
846
|
+
|
|
847
|
+
extra_query: Add additional query parameters to the request
|
|
848
|
+
|
|
849
|
+
extra_body: Add additional JSON properties to the request
|
|
850
|
+
|
|
851
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
852
|
+
"""
|
|
853
|
+
return await self._post(
|
|
854
|
+
"/search/v1/search",
|
|
855
|
+
body=await async_maybe_transform(
|
|
856
|
+
{
|
|
857
|
+
"query": query,
|
|
858
|
+
"additional_queries": additional_queries,
|
|
859
|
+
"category": category,
|
|
860
|
+
"contents": contents,
|
|
861
|
+
"end_crawl_date": end_crawl_date,
|
|
862
|
+
"end_published_date": end_published_date,
|
|
863
|
+
"exclude_domains": exclude_domains,
|
|
864
|
+
"include_domains": include_domains,
|
|
865
|
+
"include_text": include_text,
|
|
866
|
+
"num_results": num_results,
|
|
867
|
+
"start_crawl_date": start_crawl_date,
|
|
868
|
+
"start_published_date": start_published_date,
|
|
869
|
+
"type": type,
|
|
870
|
+
"user_location": user_location,
|
|
871
|
+
},
|
|
872
|
+
v1_search_params.V1SearchParams,
|
|
873
|
+
),
|
|
874
|
+
options=make_request_options(
|
|
875
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
876
|
+
),
|
|
877
|
+
cast_to=V1SearchResponse,
|
|
878
|
+
)
|
|
879
|
+
|
|
880
|
+
async def similar(
|
|
881
|
+
self,
|
|
882
|
+
*,
|
|
883
|
+
url: str,
|
|
884
|
+
contents: str | Omit = omit,
|
|
885
|
+
end_crawl_date: Union[str, date] | Omit = omit,
|
|
886
|
+
end_published_date: Union[str, date] | Omit = omit,
|
|
887
|
+
exclude_domains: SequenceNotStr[str] | Omit = omit,
|
|
888
|
+
include_domains: SequenceNotStr[str] | Omit = omit,
|
|
889
|
+
include_text: bool | Omit = omit,
|
|
890
|
+
num_results: int | Omit = omit,
|
|
891
|
+
start_crawl_date: Union[str, date] | Omit = omit,
|
|
892
|
+
start_published_date: Union[str, date] | Omit = omit,
|
|
893
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
894
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
895
|
+
extra_headers: Headers | None = None,
|
|
896
|
+
extra_query: Query | None = None,
|
|
897
|
+
extra_body: Body | None = None,
|
|
898
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
899
|
+
) -> V1SimilarResponse:
|
|
900
|
+
"""Find web pages and documents similar to a given URL.
|
|
901
|
+
|
|
902
|
+
Useful for legal research
|
|
903
|
+
to discover related case law, statutes, or legal commentary that shares similar
|
|
904
|
+
themes or content structure.
|
|
905
|
+
|
|
906
|
+
Args:
|
|
907
|
+
url: The URL to find similar content for
|
|
908
|
+
|
|
909
|
+
contents: Additional content to consider for similarity matching
|
|
910
|
+
|
|
911
|
+
end_crawl_date: Only include pages crawled before this date
|
|
912
|
+
|
|
913
|
+
end_published_date: Only include pages published before this date
|
|
914
|
+
|
|
915
|
+
exclude_domains: Exclude results from these domains
|
|
916
|
+
|
|
917
|
+
include_domains: Only search within these domains
|
|
918
|
+
|
|
919
|
+
include_text: Whether to include extracted text content in results
|
|
920
|
+
|
|
921
|
+
num_results: Number of similar results to return
|
|
922
|
+
|
|
923
|
+
start_crawl_date: Only include pages crawled after this date
|
|
924
|
+
|
|
925
|
+
start_published_date: Only include pages published after this date
|
|
926
|
+
|
|
927
|
+
extra_headers: Send extra headers
|
|
928
|
+
|
|
929
|
+
extra_query: Add additional query parameters to the request
|
|
930
|
+
|
|
931
|
+
extra_body: Add additional JSON properties to the request
|
|
932
|
+
|
|
933
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
934
|
+
"""
|
|
935
|
+
return await self._post(
|
|
936
|
+
"/search/v1/similar",
|
|
937
|
+
body=await async_maybe_transform(
|
|
938
|
+
{
|
|
939
|
+
"url": url,
|
|
940
|
+
"contents": contents,
|
|
941
|
+
"end_crawl_date": end_crawl_date,
|
|
942
|
+
"end_published_date": end_published_date,
|
|
943
|
+
"exclude_domains": exclude_domains,
|
|
944
|
+
"include_domains": include_domains,
|
|
945
|
+
"include_text": include_text,
|
|
946
|
+
"num_results": num_results,
|
|
947
|
+
"start_crawl_date": start_crawl_date,
|
|
948
|
+
"start_published_date": start_published_date,
|
|
949
|
+
},
|
|
950
|
+
v1_similar_params.V1SimilarParams,
|
|
951
|
+
),
|
|
952
|
+
options=make_request_options(
|
|
953
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
954
|
+
),
|
|
955
|
+
cast_to=V1SimilarResponse,
|
|
956
|
+
)
|
|
957
|
+
|
|
958
|
+
|
|
959
|
+
class V1ResourceWithRawResponse:
|
|
960
|
+
def __init__(self, v1: V1Resource) -> None:
|
|
961
|
+
self._v1 = v1
|
|
962
|
+
|
|
963
|
+
self.answer = to_raw_response_wrapper(
|
|
964
|
+
v1.answer,
|
|
965
|
+
)
|
|
966
|
+
self.contents = to_raw_response_wrapper(
|
|
967
|
+
v1.contents,
|
|
968
|
+
)
|
|
969
|
+
self.research = to_raw_response_wrapper(
|
|
970
|
+
v1.research,
|
|
971
|
+
)
|
|
972
|
+
self.retrieve_research = to_raw_response_wrapper(
|
|
973
|
+
v1.retrieve_research,
|
|
974
|
+
)
|
|
975
|
+
self.search = to_raw_response_wrapper(
|
|
976
|
+
v1.search,
|
|
977
|
+
)
|
|
978
|
+
self.similar = to_raw_response_wrapper(
|
|
979
|
+
v1.similar,
|
|
980
|
+
)
|
|
981
|
+
|
|
982
|
+
|
|
983
|
+
class AsyncV1ResourceWithRawResponse:
|
|
984
|
+
def __init__(self, v1: AsyncV1Resource) -> None:
|
|
985
|
+
self._v1 = v1
|
|
986
|
+
|
|
987
|
+
self.answer = async_to_raw_response_wrapper(
|
|
988
|
+
v1.answer,
|
|
989
|
+
)
|
|
990
|
+
self.contents = async_to_raw_response_wrapper(
|
|
991
|
+
v1.contents,
|
|
992
|
+
)
|
|
993
|
+
self.research = async_to_raw_response_wrapper(
|
|
994
|
+
v1.research,
|
|
995
|
+
)
|
|
996
|
+
self.retrieve_research = async_to_raw_response_wrapper(
|
|
997
|
+
v1.retrieve_research,
|
|
998
|
+
)
|
|
999
|
+
self.search = async_to_raw_response_wrapper(
|
|
1000
|
+
v1.search,
|
|
1001
|
+
)
|
|
1002
|
+
self.similar = async_to_raw_response_wrapper(
|
|
1003
|
+
v1.similar,
|
|
1004
|
+
)
|
|
1005
|
+
|
|
1006
|
+
|
|
1007
|
+
class V1ResourceWithStreamingResponse:
|
|
1008
|
+
def __init__(self, v1: V1Resource) -> None:
|
|
1009
|
+
self._v1 = v1
|
|
1010
|
+
|
|
1011
|
+
self.answer = to_streamed_response_wrapper(
|
|
1012
|
+
v1.answer,
|
|
1013
|
+
)
|
|
1014
|
+
self.contents = to_streamed_response_wrapper(
|
|
1015
|
+
v1.contents,
|
|
1016
|
+
)
|
|
1017
|
+
self.research = to_streamed_response_wrapper(
|
|
1018
|
+
v1.research,
|
|
1019
|
+
)
|
|
1020
|
+
self.retrieve_research = to_streamed_response_wrapper(
|
|
1021
|
+
v1.retrieve_research,
|
|
1022
|
+
)
|
|
1023
|
+
self.search = to_streamed_response_wrapper(
|
|
1024
|
+
v1.search,
|
|
1025
|
+
)
|
|
1026
|
+
self.similar = to_streamed_response_wrapper(
|
|
1027
|
+
v1.similar,
|
|
1028
|
+
)
|
|
1029
|
+
|
|
1030
|
+
|
|
1031
|
+
class AsyncV1ResourceWithStreamingResponse:
|
|
1032
|
+
def __init__(self, v1: AsyncV1Resource) -> None:
|
|
1033
|
+
self._v1 = v1
|
|
1034
|
+
|
|
1035
|
+
self.answer = async_to_streamed_response_wrapper(
|
|
1036
|
+
v1.answer,
|
|
1037
|
+
)
|
|
1038
|
+
self.contents = async_to_streamed_response_wrapper(
|
|
1039
|
+
v1.contents,
|
|
1040
|
+
)
|
|
1041
|
+
self.research = async_to_streamed_response_wrapper(
|
|
1042
|
+
v1.research,
|
|
1043
|
+
)
|
|
1044
|
+
self.retrieve_research = async_to_streamed_response_wrapper(
|
|
1045
|
+
v1.retrieve_research,
|
|
1046
|
+
)
|
|
1047
|
+
self.search = async_to_streamed_response_wrapper(
|
|
1048
|
+
v1.search,
|
|
1049
|
+
)
|
|
1050
|
+
self.similar = async_to_streamed_response_wrapper(
|
|
1051
|
+
v1.similar,
|
|
1052
|
+
)
|