Skip to content

Commit

Permalink
Merge branch 'dev' into d/cookbooks-updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Vedantsahai18 committed Oct 15, 2024
2 parents 27efd40 + 994dbe0 commit 746f9a1
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 92 deletions.
70 changes: 1 addition & 69 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,78 +24,10 @@ body:
3. Scroll down to '....'
4. See error"

- type: textarea
id: expected-behavior
attributes:
label: "👍 Expected behavior"
description: "What did you think should happen?"
placeholder: "It should ..."

- type: textarea
id: actual-behavior
attributes:
label: "👎 Actual Behavior with Screenshots"
description: "What did actually happen? Add screenshots, if applicable."
placeholder: "It actually ..."

- type: dropdown
id: operating-system
attributes:
label: "💻 Operating system"
description: "What OS is your app running on?"
options:
- Linux
- MacOS
- Windows
- Something else

- type: dropdown
id: browsers
attributes:
label: What browsers are you seeing the problem on?
multiple: true
options:
- Firefox
- Chrome
- Safari
- Microsoft Edge
- Something else

- type: textarea
id: additional-context
attributes:
label: "📃 Provide any additional context for the Bug."
description: "Add any other context about the problem here."
placeholder: "It actually ..."

- type: textarea
id: logs
attributes:
label: 📖 Relevant log output
description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks.
render: shell

- type: checkboxes
id: no-duplicate-issues
attributes:
label: "👀 Have you spent some time to check if this bug has been raised before?"
options:
- label: "I checked and didn't find similar issue"

- type: dropdown
id: willing-to-submit-pr
attributes:
label: 🔗 Are you willing to submit PR?
description: This is absolutely not required, but we are happy to guide you in the contribution process.
options: # Added options key
- "Yes, I am willing to submit a PR!"
- "No"


- type: checkboxes
id: terms
attributes:
label: 🧑‍⚖️ Code of Conduct
description: By submitting this issue, you agree to follow our [Code of Conduct](https://github.com/julep-ai/julep/blob/dev/.github/CODE_OF_CONDUCT.md)
options:
- label: I agree to follow this project's Code of Conduct
required: true
14 changes: 0 additions & 14 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,18 @@ body:
placeholder: "You should add ..."
- type: textarea
id: pitch
validations:
required: true
attributes:
label: "🎤 Why is this feature needed ?"
description: "Please explain why this feature should be implemented and how it would be used. Add examples, if applicable."
placeholder: "In my use-case, ..."
- type: textarea
id: solution
validations:
required: true
attributes:
label: "✌️ How do you aim to achieve this?"
description: "A clear and concise description of what you want to happen."
placeholder: "I want this feature to, ..."
- type: textarea
id: alternative
validations:
required: false
attributes:
label: "🔄️ Additional Information"
description: "A clear and concise description of any alternative solutions or additional solutions you've considered."
Expand All @@ -52,11 +46,3 @@ body:
description: This is absolutely not required, but we are happy to guide you in the contribution process.
options:
- "Yes I am willing to submit a PR!"
- type: checkboxes
id: terms
attributes:
label: 🧑‍⚖️ Code of Conduct
description: By submitting this issue, you agree to follow our [Code of Conduct](https://github.com/julep-ai/julep/blob/dev/.github/CODE_OF_CONDUCT.md)
options:
- label: I agree to follow this project's Code of Conduct
required: true
34 changes: 25 additions & 9 deletions agents-api/agents_api/activities/embed_docs.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
import asyncio
import operator
from functools import reduce
from itertools import batched

from beartype import beartype
from temporalio import activity

Expand All @@ -8,18 +13,27 @@


@beartype
async def embed_docs(payload: EmbedDocsPayload, cozo_client=None) -> None:
async def embed_docs(
payload: EmbedDocsPayload, cozo_client=None, max_batch_size: int = 100
) -> None:
indices, snippets = list(zip(*enumerate(payload.content)))
batched_snippets = batched(snippets, max_batch_size)
embed_instruction: str = payload.embed_instruction or ""
title: str = payload.title or ""

embeddings = await litellm.aembedding(
inputs=[
(
embed_instruction + (title + "\n\n" + snippet) if title else snippet
).strip()
for snippet in snippets
]
async def embed_batch(snippets):
return await litellm.aembedding(
inputs=[
(
embed_instruction + (title + "\n\n" + snippet) if title else snippet
).strip()
for snippet in snippets
]
)

embeddings = reduce(
operator.add,
await asyncio.gather(*[embed_batch(snippets) for snippets in batched_snippets]),
)

embed_snippets_query(
Expand All @@ -31,7 +45,9 @@ async def embed_docs(payload: EmbedDocsPayload, cozo_client=None) -> None:
)


async def mock_embed_docs(payload: EmbedDocsPayload, cozo_client=None) -> None:
async def mock_embed_docs(
payload: EmbedDocsPayload, cozo_client=None, max_batch_size=100
) -> None:
# Does nothing
return None

Expand Down
8 changes: 8 additions & 0 deletions agents-api/agents_api/models/docs/search_docs_by_embedding.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ def search_docs_by_embedding(
index1,
min(dist)
] :=
candidate[doc_id],
*snippets {{
doc_id,
index: index1,
Expand All @@ -109,19 +110,24 @@ def search_docs_by_embedding(
index: index2,
embedding: embedding2
}},
is_null(embedding1) == false,
is_null(embedding2) == false,
index1 < index2,
dist = cos_dist(embedding1, embedding2)
doclength[doc_id, max(index)] :=
candidate[doc_id],
*snippets {{
doc_id,
index,
}}
get_intersnippet[doc_id, index, distance] :=
candidate[doc_id],
intersnippet_distance[doc_id, _, distance]
get_intersnippet[doc_id, index, distance] :=
candidate[doc_id],
not intersnippet_distance[doc_id, _, distance],
distance = 0.0
Expand Down Expand Up @@ -151,6 +157,7 @@ def search_docs_by_embedding(
distance,
mmr_score,
] :=
candidate[doc_id],
search_result[doc_id, content, index, distance],
get_intersnippet[doc_id, index, intersnippet_distance],
mmr_score = {mmr_lambda} * (distance - (1.0 - {mmr_lambda}) * intersnippet_distance),
Expand All @@ -165,6 +172,7 @@ def search_docs_by_embedding(
mmr_score,
title,
] :=
candidate[doc_id],
*docs {{
owner_type,
owner_id,
Expand Down
1 change: 1 addition & 0 deletions agents-api/agents_api/models/docs/search_docs_by_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ def search_docs_by_text(
distance,
title,
] :=
candidate[id],
input[owner_type, owner_id],
m[
id,
Expand Down

0 comments on commit 746f9a1

Please sign in to comment.