Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

session.chat working without specifying user #338

Merged
merged 2 commits into from
May 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions agents-api/agents_api/common/protocol/sessions.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

from .agents import AgentDefaultSettings

from typing import Optional, Dict


class SessionSettings(AgentDefaultSettings):
"""
Expand All @@ -26,19 +28,19 @@ class SessionData(BaseModel):
"""

agent_id: UUID
user_id: UUID
user_id: Optional[UUID]
session_id: UUID
situation: str
summary: str | None
user_name: str | None
user_about: str
agent_name: str | None
summary: Optional[str]
user_name: Optional[str]
user_about: Optional[str]
agent_name: Optional[str]
agent_about: str
updated_at: float
created_at: float
model: str
default_settings: SessionSettings
render_templates: bool = False
metadata: dict = {}
user_metadata: dict = {}
agent_metadata: dict = {}
metadata: Dict = {}
user_metadata: Optional[Dict] = None
agent_metadata: Dict = {}
4 changes: 2 additions & 2 deletions agents-api/agents_api/models/entry/proc_mem_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def proc_mem_context_query(
:create _input {{
session_id: Uuid,
agent_id: Uuid,
user_id: Uuid,
user_id: Uuid?,
creatorrr marked this conversation as resolved.
Show resolved Hide resolved
# tool_query: <F32; {VECTOR_SIZE}>,
doc_query: <F32; {VECTOR_SIZE}>,
}}
Expand Down Expand Up @@ -213,7 +213,7 @@ def proc_mem_context_query(
user_doc_id: Uuid? default null,
}}
}} {{
# Collect document information based on agent ID and document query embedding.
# Collect document information based on user ID and document query embedding.
# Collect user docs

# Search for user docs
Expand Down
68 changes: 68 additions & 0 deletions agents-api/agents_api/models/session/session_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,74 @@ def session_data_query(
"min_p": min_p,
"preset": preset,
}
?[
agent_id,
user_id,
session_id,
situation,
summary,
updated_at,
created_at,
user_name,
user_about,
agent_name,
agent_about,
model,
default_settings,
metadata,
render_templates,
user_metadata,
agent_metadata,
] := input[developer_id, session_id],
*sessions{
developer_id,
session_id,
situation,
summary,
created_at,
updated_at: validity,
metadata,
render_templates,
@ "NOW"
},
*session_lookup{
agent_id,
user_id,
session_id,
}, updated_at = to_int(validity),
not *users{
user_id
}, user_name=null, user_about=null, user_metadata=null,
*agents{
agent_id,
name: agent_name,
about: agent_about,
model,
metadata: agent_metadata,
},
*agent_default_settings {
agent_id,
frequency_penalty,
presence_penalty,
length_penalty,
repetition_penalty,
top_p,
temperature,
min_p,
preset,
},
default_settings = {
"frequency_penalty": frequency_penalty,
"presence_penalty": presence_penalty,
"length_penalty": length_penalty,
"repetition_penalty": repetition_penalty,
"top_p": top_p,
"temperature": temperature,
"min_p": min_p,
"preset": preset,
}


"""

return (query, {"developer_id": str(developer_id), "session_id": str(session_id)})
Expand Down
4 changes: 4 additions & 0 deletions agents-api/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ services:
image: ghcr.io/huggingface/text-embeddings-inference:1.0
ports:
- "8082:80"
volumes:
- ~/.cache/huggingface/hub:/data
shm_size: "2gb"
deploy:
resources:
Expand All @@ -82,6 +84,8 @@ services:
image: ghcr.io/huggingface/text-embeddings-inference:1.0
ports:
- "8083:80"
volumes:
- ~/.cache/huggingface/hub:/data
shm_size: "2gb"
deploy:
resources:
Expand Down
Loading