Skip to content

Commit

Permalink
Merge branch 'dev' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
creatorrr authored Oct 3, 2024
2 parents d9f12e5 + 3ad1926 commit 15f68e4
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 2 deletions.
7 changes: 7 additions & 0 deletions agents-api/agents_api/autogen/Docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,13 @@ class Doc(BaseModel):
"""
Contents of the document
"""
embeddings: Annotated[
list[float] | list[list[float]] | None,
Field(None, json_schema_extra={"readOnly": True}),
]
"""
Embeddings for the document
"""


class DocOwner(BaseModel):
Expand Down
4 changes: 3 additions & 1 deletion agents-api/agents_api/models/docs/get_doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
one=True,
transform=lambda d: {
"content": [s[1] for s in sorted(d["snippet_data"], key=lambda x: x[0])],
"embeddings": [s[2] for s in sorted(d["snippet_data"], key=lambda x: x[0])],
**d,
},
)
Expand Down Expand Up @@ -68,8 +69,9 @@ def get_doc(
doc_id,
index,
content,
embedding,
},
snippet_data = [index, content]
snippet_data = [index, content, embedding]
?[
id,
Expand Down
4 changes: 3 additions & 1 deletion agents-api/agents_api/models/docs/list_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
Doc,
transform=lambda d: {
"content": [s[1] for s in sorted(d["snippet_data"], key=lambda x: x[0])],
"embeddings": [s[2] for s in sorted(d["snippet_data"], key=lambda x: x[0])],
**d,
},
)
Expand Down Expand Up @@ -67,8 +68,9 @@ def list_docs(
doc_id: id,
index,
content,
embedding,
}},
snippet_data = [index, content]
snippet_data = [index, content, embedding]
?[
owner_type,
Expand Down
4 changes: 4 additions & 0 deletions typespec/docs/models.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ model Doc {

/** Contents of the document */
content: string | string[];

/** Embeddings for the document */
@visibility("read")
embeddings?: float32[] | float32[][];
}

/** Payload for creating a doc */
Expand Down

0 comments on commit 15f68e4

Please sign in to comment.