Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions perigon/api/v1_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -3304,10 +3304,7 @@ async def search_summarizer_async(
params = _normalise_query(params)

resp = await self.api_client.request_async(
"POST",
path,
params=params,
json=summary_body.model_dump(by_alias=True, exclude_none=True),
"POST", path, params=params, json=summary_body.model_dump(by_alias=True)
)
resp.raise_for_status()
return SummarySearchResult.model_validate(resp.json())
Expand Down
24 changes: 24 additions & 0 deletions perigon/models/company.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ class Company(BaseModel):
symbols: Optional[List[SymbolHolder]] = None
naics: Optional[StrictStr] = None
sic: Optional[StrictStr] = None
cusip: Optional[StrictStr] = None
cik: Optional[StrictStr] = None
isin: Optional[StrictStr] = None
year_founded: Optional[StrictInt] = Field(default=None, alias="yearFounded")
revenue: Optional[StrictStr] = None
web_resources: Optional[WebResources] = Field(default=None, alias="webResources")
Expand Down Expand Up @@ -96,6 +99,9 @@ class Company(BaseModel):
"symbols",
"naics",
"sic",
"cusip",
"cik",
"isin",
"yearFounded",
"revenue",
"webResources",
Expand Down Expand Up @@ -292,6 +298,21 @@ def to_dict(self) -> Dict[str, Any]:
if self.sic is None and "sic" in self.model_fields_set:
_dict["sic"] = None

# set to None if cusip (nullable) is None
# and model_fields_set contains the field
if self.cusip is None and "cusip" in self.model_fields_set:
_dict["cusip"] = None

# set to None if cik (nullable) is None
# and model_fields_set contains the field
if self.cik is None and "cik" in self.model_fields_set:
_dict["cik"] = None

# set to None if isin (nullable) is None
# and model_fields_set contains the field
if self.isin is None and "isin" in self.model_fields_set:
_dict["isin"] = None

# set to None if year_founded (nullable) is None
# and model_fields_set contains the field
if self.year_founded is None and "year_founded" in self.model_fields_set:
Expand Down Expand Up @@ -351,6 +372,9 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
),
"naics": obj.get("naics"),
"sic": obj.get("sic"),
"cusip": obj.get("cusip"),
"cik": obj.get("cik"),
"isin": obj.get("isin"),
"yearFounded": obj.get("yearFounded"),
"revenue": obj.get("revenue"),
"webResources": (
Expand Down
6 changes: 4 additions & 2 deletions tests/integration/test_v1api.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,11 @@ def test_vector_search(api: V1Api):


def test_summarizer(api: V1Api):
summary_body = SummaryBody() # empty body is valid
# Use gpt-4o-mini which is more stable and widely supported
summary_body = SummaryBody()
result = api.search_summarizer(
summary_body=summary_body, q="renewable energy", size=10
summary_body=summary_body,
q="AI",
)
assert result.summary and len(result.results) > 0

Expand Down