Skip to content

Commit

Permalink
Merge branch 'dev' into x/integration-creation-failed-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
creatorrr authored Oct 4, 2024
2 parents 289e87e + 9c38da1 commit 7b10464
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint-and-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
uses: actions/cache@v4
with:
path: agents-api/.pytype
key: ${{ runner.os }}-agents-api-pytype-${{ hashFiles('agents-api/**/*.py') }}
key: ${{ runner.os }}-agents-api-pytype-
restore-keys: |
${{ runner.os }}-agents-api-pytype-
Expand Down
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
6 changes: 3 additions & 3 deletions agents-api/agents_api/models/agent/create_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
in str(e): lambda *_: HTTPException(
detail="developer not found", status_code=403
),
QueryException: partialclass(HTTPException, status_code=400),
ValidationError: partialclass(HTTPException, status_code=400),
TypeError: partialclass(HTTPException, status_code=400),
QueryException: partialclass(HTTPException, status_code=400, detail="A database query failed to return the expected results. This might occur if the requested resource doesn't exist or your query parameters are incorrect."),
ValidationError: partialclass(HTTPException, status_code=400, detail="Input validation failed. Please check the provided data for missing or incorrect fields, and ensure it matches the required format."),
TypeError: partialclass(HTTPException, status_code=400, detail="A type mismatch occurred. This likely means the data provided is of an incorrect type (e.g., string instead of integer). Please review the input and try again."),
}
)
@wrap_in_class(
Expand Down
6 changes: 3 additions & 3 deletions agents-api/agents_api/models/agent/create_or_update_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@

@rewrap_exceptions(
{
QueryException: partialclass(HTTPException, status_code=400),
ValidationError: partialclass(HTTPException, status_code=400),
TypeError: partialclass(HTTPException, status_code=400),
QueryException: partialclass(HTTPException, status_code=400,detail="A database query failed to return the expected results. This might occur if the requested resource doesn't exist or your query parameters are incorrect."),
ValidationError: partialclass(HTTPException, status_code=400,detail="Input validation failed. Please check the provided data for missing or incorrect fields, and ensure it matches the required format."),
TypeError: partialclass(HTTPException, status_code=400,detail="A type mismatch occurred. This likely means the data provided is of an incorrect type (e.g., string instead of integer). Please review the input and try again."),
}
)
@wrap_in_class(
Expand Down
6 changes: 3 additions & 3 deletions agents-api/agents_api/models/agent/delete_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
in e.resp["display"]: lambda *_: HTTPException(
detail="developer not found or doesnt own resource", status_code=404
),
QueryException: partialclass(HTTPException, status_code=400),
ValidationError: partialclass(HTTPException, status_code=400),
TypeError: partialclass(HTTPException, status_code=400),
QueryException: partialclass(HTTPException, status_code=400,detail="A database query failed to return the expected results. This might occur if the requested resource doesn't exist or your query parameters are incorrect."),
ValidationError: partialclass(HTTPException, status_code=400,detail="Input validation failed. Please check the provided data for missing or incorrect fields, and ensure it matches the required format."),
TypeError: partialclass(HTTPException, status_code=400,detail="A type mismatch occurred. This likely means the data provided is of an incorrect type (e.g., string instead of integer). Please review the input and try again."),
}
)
@wrap_in_class(
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 7b10464

Please sign in to comment.