@@ -3,30 +3,85 @@ import Groq from 'groq-sdk';
|
||||
import OpenAI from 'openai';
|
||||
import { BusinessListingCriteria } from '../models/main.model';
|
||||
|
||||
const businessListingCriteriaStructure = {
|
||||
criteriaType: 'business | commercialProperty | broker',
|
||||
types: "'Automotive'|'Industrial Services'|'Food and Restaurant'|'Real Estate'|'Retail'|'Oilfield SVE and MFG.'|'Service'|'Advertising'|'Agriculture'|'Franchise'|'Professional'|'Manufacturing'",
|
||||
city: 'string',
|
||||
state: 'string',
|
||||
county: 'string',
|
||||
minPrice: 'number',
|
||||
maxPrice: 'number',
|
||||
minRevenue: 'number',
|
||||
maxRevenue: 'number',
|
||||
minCashFlow: 'number',
|
||||
maxCashFlow: 'number',
|
||||
minNumberEmployees: 'number',
|
||||
maxNumberEmployees: 'number',
|
||||
establishedSince: 'number',
|
||||
establishedUntil: 'number',
|
||||
realEstateChecked: 'boolean',
|
||||
leasedLocation: 'boolean',
|
||||
franchiseResale: 'boolean',
|
||||
title: 'string',
|
||||
brokerName: 'string',
|
||||
searchType: "'exact' | 'radius'",
|
||||
radius: "'0' | '5' | '20' | '50' | '100' | '200' | '300' | '400' | '500'",
|
||||
};
|
||||
// const businessListingCriteriaStructure = {
|
||||
// criteriaType: 'business | commercialProperty | broker',
|
||||
// types: "'Automotive'|'Industrial Services'|'Food and Restaurant'|'Real Estate'|'Retail'|'Oilfield SVE and MFG.'|'Service'|'Advertising'|'Agriculture'|'Franchise'|'Professional'|'Manufacturing'",
|
||||
// city: 'string',
|
||||
// state: 'string',
|
||||
// county: 'string',
|
||||
// minPrice: 'number',
|
||||
// maxPrice: 'number',
|
||||
// minRevenue: 'number',
|
||||
// maxRevenue: 'number',
|
||||
// minCashFlow: 'number',
|
||||
// maxCashFlow: 'number',
|
||||
// minNumberEmployees: 'number',
|
||||
// maxNumberEmployees: 'number',
|
||||
// establishedSince: 'number',
|
||||
// establishedUntil: 'number',
|
||||
// realEstateChecked: 'boolean',
|
||||
// leasedLocation: 'boolean',
|
||||
// franchiseResale: 'boolean',
|
||||
// title: 'string',
|
||||
// brokerName: 'string',
|
||||
// searchType: "'exact' | 'radius'",
|
||||
// radius: "'0' | '5' | '20' | '50' | '100' | '200' | '300' | '400' | '500'",
|
||||
// };
|
||||
|
||||
const BusinessListingCriteriaStructure = `
|
||||
export interface BusinessListingCriteria {
|
||||
state: string;
|
||||
city: string;
|
||||
searchType: 'exact' | 'radius';
|
||||
radius: '20' | '50' | '100' | '200' | '300' | '400' | '500';
|
||||
|
||||
minPrice: number;
|
||||
maxPrice: number;
|
||||
minRevenue: number;
|
||||
maxRevenue: number;
|
||||
minCashFlow: number;
|
||||
maxCashFlow: number;
|
||||
minNumberEmployees: number;
|
||||
maxNumberEmployees: number;
|
||||
establishedSince: number;
|
||||
establishedUntil: number;
|
||||
realEstateChecked: boolean;
|
||||
leasedLocation: boolean;
|
||||
franchiseResale: boolean;
|
||||
//title: string;
|
||||
brokerName: string;
|
||||
//types:"'Automotive'|'Industrial Services'|'Food and Restaurant'|'Real Estate'|'Retail'|'Oilfield SVE and MFG.'|'Service'|'Advertising'|'Agriculture'|'Franchise'|'Professional'|'Manufacturing'",
|
||||
criteriaType: 'businessListings';
|
||||
}
|
||||
`;
|
||||
const CommercialPropertyListingCriteriaStructure = `
|
||||
export interface CommercialPropertyListingCriteria {
|
||||
state: string;
|
||||
city: string;
|
||||
searchType: 'exact' | 'radius';
|
||||
radius: '20' | '50' | '100' | '200' | '300' | '400' | '500';
|
||||
|
||||
minPrice: number;
|
||||
maxPrice: number;
|
||||
//title: string;
|
||||
//types:"'Retail'|'Land'|'Industrial'|'Office'|'Mixed Use'|'Multifamily'|'Uncategorized'"
|
||||
criteriaType: 'commercialPropertyListings';
|
||||
}
|
||||
`;
|
||||
const UserListingCriteriaStructure = `
|
||||
export interface UserListingCriteria {
|
||||
state: string;
|
||||
city: string;
|
||||
searchType: 'exact' | 'radius';
|
||||
radius: '20' | '50' | '100' | '200' | '300' | '400' | '500';
|
||||
|
||||
brokerName: string;
|
||||
companyName: string;
|
||||
counties: string[];
|
||||
criteriaType: 'brokerListings';
|
||||
}
|
||||
|
||||
`;
|
||||
@Injectable()
|
||||
export class AiService {
|
||||
private readonly openai: OpenAI;
|
||||
@@ -67,8 +122,10 @@ export class AiService {
|
||||
{
|
||||
role: 'system',
|
||||
content: `Please create unformatted JSON Object from a user input.
|
||||
The type must be: ${JSON.stringify(businessListingCriteriaStructure)}.
|
||||
If location details available please fill city and state as State Code and only county if explicitly mentioned`,
|
||||
The criteriaType must be only either 'businessListings' or 'commercialPropertyListings' or 'brokerListings' !!!!
|
||||
The format of the object (depending on your choice of criteriaType) must be either ${BusinessListingCriteriaStructure}, ${CommercialPropertyListingCriteriaStructure} or ${UserListingCriteriaStructure} !!!!
|
||||
If location details available please fill city and state as State Code and only county if explicitly mentioned.
|
||||
If you decide for searchType==='exact', please do not set the attribute radius`,
|
||||
},
|
||||
{
|
||||
role: 'user',
|
||||
|
||||
Reference in New Issue
Block a user