Skip to content

Commit 795a7c1

Browse files
update fern definition
1 parent 122fd82 commit 795a7c1

File tree

8 files changed

+348
-0
lines changed

8 files changed

+348
-0
lines changed
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
docs: FAI Analytics API
2+
3+
imports:
4+
commons: ./commons.yml
5+
6+
service:
7+
auth: false
8+
base-path: /analytics
9+
endpoints:
10+
getHistogramAnalytics:
11+
docs: Retrieve the usage histogram analytics for a given period
12+
path: /histogram/{domain}
13+
method: GET
14+
path-parameters:
15+
domain: string
16+
request:
17+
name: GetHistogramAnalyticsRequest
18+
query-parameters:
19+
start_date:
20+
type: optional<datetime>
21+
docs: The start date of the period to retrieve analytics for
22+
end_date:
23+
type: optional<datetime>
24+
docs: The end date of the period to retrieve analytics for
25+
groupBy:
26+
type: GroupBy
27+
docs: The field to group the analytics by
28+
response: HistogramAnalytics
29+
errors:
30+
- commons.BadRequestError
31+
- commons.InternalError
32+
getInsights:
33+
docs: Retrieve the insights for a given period
34+
path: /insights/{domain}
35+
method: GET
36+
path-parameters:
37+
domain: string
38+
request:
39+
name: GetInsightsRequest
40+
query-parameters:
41+
start_date:
42+
type: optional<datetime>
43+
docs: The start date of the period to retrieve analytics for
44+
end_date:
45+
type: optional<datetime>
46+
docs: The end date of the period to retrieve analytics for
47+
response: Insights
48+
errors:
49+
- commons.BadRequestError
50+
- commons.InternalError
51+
52+
types:
53+
GroupBy:
54+
enum:
55+
- "DAY"
56+
- "WEEK"
57+
- "MONTH"
58+
59+
HistogramAnalytics:
60+
properties:
61+
bars: list<HistogramAnalyticsBar>
62+
63+
HistogramAnalyticsBar:
64+
properties:
65+
label: string
66+
queryCount: integer
67+
conversationCount: integer
68+
69+
Insights:
70+
properties:
71+
insights: list<Insight>
72+
73+
Insight:
74+
properties:
75+
insightText: string
76+
numberOfQueries: integer
77+
examples: list<string>
78+

fern/apis/fai/definition/api.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
name: fai
2+
auth: bearer
3+
default-environment: Prod
4+
environments:
5+
Prod: https://fai.buildwithfern.com
6+
error-discrimination:
7+
strategy: property
8+
property-name: error

fern/apis/fai/definition/chat.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
docs: FAI Chat API
2+
3+
imports:
4+
commons: ./commons.yml
5+
6+
service:
7+
auth: false
8+
base-path: /chat
9+
endpoints:
10+
chatCompletion:
11+
docs: Create a docs chat completion for a given domain
12+
path: /{domain}
13+
method: POST
14+
path-parameters:
15+
domain: string
16+
request:
17+
name: ChatCompletionRequest
18+
body:
19+
properties:
20+
model: optional<string>
21+
system_prompt: optional<string>
22+
messages: list<ChatTurn>
23+
response: ChatCompletionResponse
24+
errors:
25+
- commons.BadRequestError
26+
- commons.InternalError
27+
28+
types:
29+
ChatCompletionResponse:
30+
type: list<ChatTurn>
31+
32+
ChatTurn:
33+
properties:
34+
role: string
35+
content: string
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# yaml-language-server: $schema=https://raw.githubusercontent.com/fern-api/fern/main/fern.schema.json
2+
errors:
3+
BadRequestError:
4+
status-code: 400
5+
type: string
6+
7+
InternalError:
8+
status-code: 401
9+
type: string
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
docs: FAI Conversations API
2+
3+
imports:
4+
commons: ./commons.yml
5+
6+
service:
7+
auth: false
8+
base-path: /conversations
9+
endpoints:
10+
getConversation:
11+
docs: Retrieve a complete conversation by conversation id
12+
path: /{domain}/{conversation_id}
13+
method: GET
14+
path-parameters:
15+
domain: string
16+
conversation_id: string
17+
response: Conversation
18+
errors:
19+
- commons.BadRequestError
20+
- commons.InternalError
21+
22+
types:
23+
Conversation:
24+
properties:
25+
conversation_id: string
26+
created_at: datetime
27+
turns: list<ConversationTurn>
28+
29+
Conversations:
30+
type: list<Conversation>
31+
32+
ConversationSource:
33+
default: CHAT
34+
enum:
35+
- CHAT
36+
- MCP
37+
38+
ConversationTurn:
39+
properties:
40+
role: string
41+
text: string
42+
created_at: datetime

fern/apis/fai/definition/index.yml

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
docs: FAI Index API
2+
3+
imports:
4+
commons: ./commons.yml
5+
6+
service:
7+
auth: false
8+
base-path: /index
9+
endpoints:
10+
indexDocument:
11+
docs: Index a document for a given domain
12+
path: /{domain}
13+
method: POST
14+
path-parameters:
15+
domain: string
16+
request:
17+
name: IndexRequest
18+
body:
19+
properties:
20+
index_name:
21+
type: optional<string>
22+
default: custom
23+
docs: The name of the index to which the document will be added
24+
document_id:
25+
type: string
26+
docs: A unique identifier for the document
27+
context:
28+
type: list<string>
29+
docs: The context of the document, as a list of strings, that will be indexed.
30+
content:
31+
type: string
32+
docs: The content of the document that will be returned in the tool response
33+
errors:
34+
- commons.BadRequestError
35+
- commons.InternalError
36+
37+
getDocument:
38+
docs: Get a document for a given domain
39+
path: /{domain}
40+
method: GET
41+
path-parameters:
42+
domain: string
43+
request:
44+
name: GetRequest
45+
query-parameters:
46+
document_id:
47+
type: string
48+
docs: The unique identifier of the document to get
49+
errors:
50+
- commons.BadRequestError
51+
- commons.InternalError
52+
53+
updateDocument:
54+
docs: Update a document for a given domain
55+
path: /{domain}/update
56+
method: POST
57+
path-parameters:
58+
domain: string
59+
request:
60+
name: UpdateRequest
61+
query-parameters:
62+
document_id:
63+
type: string
64+
docs: The unique identifier of the document to update
65+
is_active:
66+
type: boolean
67+
docs: Whether the document is active
68+
context:
69+
type: list<string>
70+
docs: The context of the document, as a list of strings, that will be indexed.
71+
content:
72+
type: string
73+
docs: The content of the document that will be returned in the tool response. If not provided, the document will be removed from the index.
74+
response: ContextResponse
75+
errors:
76+
- commons.BadRequestError
77+
- commons.InternalError
78+
79+
types:
80+
ContextResponse:
81+
properties:
82+
document_id: string
83+
domain: string
84+
context_id: string
85+
context: list<string>
86+
content: string
87+
is_active: boolean
88+
created_at: datetime
89+
updated_at: datetime
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
docs: FAI Queries API
2+
3+
imports:
4+
commons: ./commons.yml
5+
conversations: ./conversations.yml
6+
7+
service:
8+
auth: false
9+
base-path: /
10+
endpoints:
11+
createQuery:
12+
docs: Log a new query to the FAI DB
13+
path: /queries
14+
method: POST
15+
request:
16+
name: CreateQueryRequest
17+
body:
18+
properties:
19+
query_id: string
20+
conversation_id: string
21+
domain: string
22+
text: string
23+
role: string
24+
source: string
25+
created_at: datetime
26+
time_to_first_token:
27+
type: optional<double>
28+
docs: Time in seconds until first token was received. Only specified for Assistant responses.
29+
errors:
30+
- commons.BadRequestError
31+
- commons.InternalError
32+
33+
getRecentQueries:
34+
docs: Retrieve all paginated recent queries
35+
path: /queries/{domain}
36+
method: GET
37+
path-parameters:
38+
domain:
39+
type: string
40+
docs: The domain to retrieve queries for
41+
request:
42+
name: GetRecentQueriesRequest
43+
query-parameters:
44+
page: optional<integer>
45+
limit: optional<integer>
46+
cutoff_time: optional<datetime>
47+
include_assistant: optional<boolean>
48+
start_date:
49+
type: optional<datetime>
50+
docs: The start date of the period to retrieve analytics for
51+
end_date:
52+
type: optional<datetime>
53+
docs: The end date of the period to retrieve analytics for
54+
response: QueryPage
55+
errors:
56+
- commons.BadRequestError
57+
- commons.InternalError
58+
59+
types:
60+
Query:
61+
properties:
62+
query_id: string
63+
conversation_id: string
64+
domain: string
65+
text: string
66+
role: string
67+
source: string
68+
created_at: datetime
69+
time_to_first_token: optional<double>
70+
71+
QueryPage:
72+
properties:
73+
queries: list<Query>
74+
total: integer

fern/apis/fai/generators.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
default-group: local
2+
3+
groups:
4+
local:
5+
generators:
6+
- name: fernapi/fern-typescript-node-sdk
7+
version: 2.0.0
8+
output:
9+
location: npm
10+
url: npm.buildwithfern.com
11+
package-name: "@fern-api/fai-sdk"
12+
github:
13+
repository: fern-api/fai-sdk

0 commit comments

Comments
 (0)