Skip to content

Commit

Permalink
add optional id tests; fix pytype, remove model field
Browse files Browse the repository at this point in the history
  • Loading branch information
alt-glitch committed Jul 3, 2024
1 parent 43fe43e commit c0c862b
Show file tree
Hide file tree
Showing 13 changed files with 37 additions and 40 deletions.
6 changes: 1 addition & 5 deletions agents-api/agents_api/autogen/openapi_model.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# generated by datamodel-codegen:
# filename: openapi.yaml
# timestamp: 2024-07-03T01:16:01+00:00
# timestamp: 2024-07-03T06:12:30+00:00

from __future__ import annotations

Expand Down Expand Up @@ -514,10 +514,6 @@ class ChatSettings(BaseModel):
"""
Generation preset name (problem_solving|conversational|fun|prose|creative|business|deterministic|code|multilingual)
"""
model: str | None = None
"""
Model name
"""


class Preset1(str, Enum):
Expand Down
3 changes: 0 additions & 3 deletions agents-api/tests/test_agents.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
def _(client=client):
agent = client.agents.create(
name="Samantha",
id=uuid.uuid4(),
about="about Samantha",
instructions=[
"non-important content",
Expand Down Expand Up @@ -132,7 +131,6 @@ def _(client=client):
async def _(client=async_client):
agent = await client.agents.create(
name="Samantha",
id=uuid.uuid4(),
about="about Samantha",
instructions=[
"non-important content",
Expand Down Expand Up @@ -172,7 +170,6 @@ def _(client=client):
try:
client.agents.create(
name="Samantha",
id=uuid.uuid4(),
about="about Samantha",
instructions=[
"non-important content",
Expand Down
2 changes: 0 additions & 2 deletions agents-api/tests/test_sessions.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ def _(user=user, agent=agent, client=client):
user_id=user.id,
agent_id=agent.id,
situation="test situation",
id=uuid.uuid4(),
)

assert isinstance(response, ResourceCreatedResponse)
Expand All @@ -79,7 +78,6 @@ async def _(user=user, agent=agent, client=async_client):
agent_id=agent.id,
situation="test situation",
id=uuid.uuid4(),

)

assert isinstance(response, ResourceCreatedResponse)
Expand Down
1 change: 0 additions & 1 deletion agents-api/tests/test_users.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ def _(client=client):
async def _(client=async_client):
response = await client.users.create(
name="test user",
id=uuid.uuid4(),
about="test user about",
)

Expand Down
3 changes: 0 additions & 3 deletions mock_openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1993,9 +1993,6 @@ components:
- deterministic
- code
- multilingual
model:
type: string
description: Model name
AgentDefaultSettings:
type: object
properties:
Expand Down
3 changes: 0 additions & 3 deletions openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1993,9 +1993,6 @@ components:
- deterministic
- code
- multilingual
model:
type: string
description: Model name
AgentDefaultSettings:
type: object
properties:
Expand Down
10 changes: 0 additions & 10 deletions sdks/python/julep/api/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -771,7 +771,6 @@ def chat(
top_p: typing.Optional[float] = OMIT,
min_p: typing.Optional[float] = OMIT,
preset: typing.Optional[ChatSettingsPreset] = OMIT,
model: typing.Optional[str] = OMIT,
recall: typing.Optional[bool] = OMIT,
record: typing.Optional[bool] = OMIT,
remember: typing.Optional[bool] = OMIT,
Expand Down Expand Up @@ -822,8 +821,6 @@ def chat(
- preset: typing.Optional[ChatSettingsPreset]. Generation preset name (problem_solving|conversational|fun|prose|creative|business|deterministic|code|multilingual)
- model: typing.Optional[str]. Model name
- recall: typing.Optional[bool]. Whether previous memories should be recalled or not
- record: typing.Optional[bool]. Whether this interaction should be recorded in history or not
Expand Down Expand Up @@ -878,8 +875,6 @@ def chat(
_request["min_p"] = min_p
if preset is not OMIT:
_request["preset"] = preset.value
if model is not OMIT:
_request["model"] = model
if recall is not OMIT:
_request["recall"] = recall
if record is not OMIT:
Expand Down Expand Up @@ -2582,7 +2577,6 @@ async def chat(
top_p: typing.Optional[float] = OMIT,
min_p: typing.Optional[float] = OMIT,
preset: typing.Optional[ChatSettingsPreset] = OMIT,
model: typing.Optional[str] = OMIT,
recall: typing.Optional[bool] = OMIT,
record: typing.Optional[bool] = OMIT,
remember: typing.Optional[bool] = OMIT,
Expand Down Expand Up @@ -2633,8 +2627,6 @@ async def chat(
- preset: typing.Optional[ChatSettingsPreset]. Generation preset name (problem_solving|conversational|fun|prose|creative|business|deterministic|code|multilingual)
- model: typing.Optional[str]. Model name
- recall: typing.Optional[bool]. Whether previous memories should be recalled or not
- record: typing.Optional[bool]. Whether this interaction should be recorded in history or not
Expand Down Expand Up @@ -2689,8 +2681,6 @@ async def chat(
_request["min_p"] = min_p
if preset is not OMIT:
_request["preset"] = preset.value
if model is not OMIT:
_request["model"] = model
if recall is not OMIT:
_request["recall"] = recall
if record is not OMIT:
Expand Down
1 change: 0 additions & 1 deletion sdks/python/julep/api/types/chat_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ class ChatSettings(pydantic.BaseModel):
"multilingual)\n"
)
)
model: typing.Optional[str] = pydantic.Field(description="Model name")

def json(self, **kwargs: typing.Any) -> str:
kwargs_with_defaults: typing.Any = {
Expand Down
4 changes: 0 additions & 4 deletions sdks/ts/src/api/models/ChatSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,4 @@ export type ChatSettings = {
| "deterministic"
| "code"
| "multilingual";
/**
* Model name
*/
model?: string;
};
4 changes: 0 additions & 4 deletions sdks/ts/src/api/schemas/$ChatSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,5 @@ export const $ChatSettings = {
preset: {
type: "Enum",
},
model: {
type: "string",
description: `Model name`,
},
},
} as const;
12 changes: 10 additions & 2 deletions sdks/ts/tests/agents.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { describe, expect, test } from "@jest/globals";
import { Agent } from "../src/api";

import { v4 as uuidv4 } from "uuid";
import { setupClient } from "./fixtures";

const client = setupClient();
Expand All @@ -14,6 +14,14 @@ const mockAgent = {
default_settings: { temperature: 0.5 },
};

const mockAgentWithId = {
name: "test agent",
id: uuidv4(),
about: "test agent about",
instructions: ["test agent instructions"],
default_settings: { temperature: 0.5 },
};

const mockAgentUpdate = {
name: "updated agent",
about: "updated agent about",
Expand All @@ -36,7 +44,7 @@ describe("Julep Client Tests", () => {

test("agents.create single instruction", async () => {
const response = await client.agents.create({
...mockAgent,
...mockAgentWithId,
instructions: "test agent instructions",
});

Expand Down
19 changes: 18 additions & 1 deletion sdks/ts/tests/sessions.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// sessions.test.ts
import { afterAll, beforeAll, describe, expect, it } from "@jest/globals";

import { v4 as uuidv4 } from "uuid";
import { setupClient } from "./fixtures"; // Adjust path if necessary
import { Agent, User } from "../src/api";
import { Client } from "../src";
Expand All @@ -26,6 +26,11 @@ const mockSession = {
situation: "test situation",
};

const mockSessionWithId = {
id: uuidv4(),
situation: "test situation",
};

const mockSessionWithTemplate = {
situation: "Say 'hello {{ session.metadata.arg }}'",
metadata: { arg: "banana" },
Expand Down Expand Up @@ -65,6 +70,18 @@ describe("Sessions API", () => {
expect(response).toBeDefined();
expect(response).toHaveProperty("created_at");
});
it("sessions.create.with.ID", async () => {
const response = await client.sessions.create({
userId: testUser.id,
agentId: testAgent.id,
...mockSessionWithId,
});

testSessionId = response.id;

expect(response).toBeDefined();
expect(response).toHaveProperty("created_at");
});

it("sessions.get", async () => {
const response = await client.sessions.get(testSessionId);
Expand Down
9 changes: 8 additions & 1 deletion sdks/ts/tests/users.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// tests/user.test.ts

import { beforeAll, describe, expect, test } from "@jest/globals";
import { v4 as uuidv4 } from "uuid";

import { setupClient } from "./fixtures";
import { Client } from "../src";
Expand All @@ -16,6 +17,12 @@ const mockUserUpdate = {
about: "updated user about",
};

const mockUserWithId = {
name: "test user",
id: uuidv4(),
about: "test user about",
};

describe("User API", () => {
let client: Client;
let testUser: User;
Expand All @@ -25,7 +32,7 @@ describe("User API", () => {
});

test("users.create", async () => {
const response = await client.users.create(mockUser);
const response = await client.users.create(mockUserWithId);

testUser = response;

Expand Down

0 comments on commit c0c862b

Please sign in to comment.